[Zope] Am I doing right?

catonano a.peluso@fulltrading.it
Sun, 15 Dec 2002 20:06:59 +0100


Paul and Jerome,

Venerd=EC, 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=20
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=20=

line one.
Still, reading it a little better, I understood it uses a string as a=20
stack with the dot as a distinction point ('my.String.htm'.split(.)=20
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=20=

Zope but I have to connect to the Internet to read it. Too bad I don't=20=

always have a net connection at my disposal.


Back to us, I had to do a small modification to the 4 lines script; it=20=

was


    import string
    name =3D context.getId()
    splitname =3D id.split('.')  // where's 'id' defined?
    splitname.pop()  # get rid of the extension
    name =3D string.join(splitname, '.')  # reassemble the string
    return name

but it had to be


    import string
    name =3D context.getId()
    splitname =3D NAME.split('.')     //(the right reference is 'name' =
not=20
id ;) ))
    splitname.pop()  # get rid of the extension
    name =3D 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=20
names CONTAINS a substring.

I can search files names taht start with or end with a substring=20
(catalogue.searchResults({'code': '*' + aString}  and=20
catalogue.searchResults({'code': aString + '*')

No more. How do I search general substrings (the common 'contains'=20
relation?)

Thanks so much, anyway
Bye
Catonano=