Paul and Jerome, Venerdì, 13 Dic 2002, alle 21:32 Europe/Rome, Paul Winkler ha scritto:
On Fri, Dec 13, 2002 at 08:19:56PM +0100, Jerome Alet wrote:
I wanted to keep all but the last one, of course, so this is probably something more like this one :
return '.'.join(context.getId().split('.')[:-1])
... which does in one line what I did in 4. TMTOWTDI lives :)
thanks a lot to the both of you. I didn't realize I could place such a script to make it inherited by sub-branches even if I HAD read about acquisition !! Thanks! Now may I ask for a bit more help? i'm so near the solution! Well I used the 4 lines script because I was a bit intimidated by the 1 line one. Still, reading it a little better, I understood it uses a string as a stack with the dot as a distinction point ('my.String.htm'.split(.) should give back a stack made like this: htm String my right? ) I was disappointed when I saw I haven't got the string API reference in Zope but I have to connect to the Internet to read it. Too bad I don't always have a net connection at my disposal. Back to us, I had to do a small modification to the 4 lines script; it was import string name = context.getId() splitname = id.split('.') // where's 'id' defined? splitname.pop() # get rid of the extension name = string.join(splitname, '.') # reassemble the string return name but it had to be import string name = context.getId() splitname = NAME.split('.') //(the right reference is 'name' not id ;) )) splitname.pop() # get rid of the extension name = string.join(splitname, '.') # reassemble the string return name Ok, now, I'm a good pupil !! ;-) The one thing I can't still do is search files in my catalog whose names CONTAINS a substring. I can search files names taht start with or end with a substring (catalogue.searchResults({'code': '*' + aString} and catalogue.searchResults({'code': aString + '*') No more. How do I search general substrings (the common 'contains' relation?) Thanks so much, anyway Bye Catonano