[Zope] string module
Sebal
sbaline@excite.com
Thu, 14 Jun 2001 04:11:59 -0700 (PDT)
>On 13 Jun 2001 07:47:13 -0700, Sebal wrote:
>> I have a method what from a "MULTIPART FORM" put a file named
'myFile.pdf'
>> in a directory.
>> And after i want the methood to create a Zclass instance[PDFclass] whith
>> id=myFile.
>>
>> I tried with split, join, and translate method of string module, and I
>> can't get a valid id with split and join ; and with translate if 'myFile'
is
>> 'mypdf' (so the file is 'mypdf.pdf') I'll get 'my' as id for my PDFclass
>> instance.
>
>
>Split on the '.' not on 'pdf'.
>
>Example from the interpreter:
> >>> foo="mypdf.pdf"
> >>> id,extension = string.split(foo,'.')
> >>> print id
> mypdf
>
>Bill
This doesn't work:
1>>>mydtml_method.html:
<dtml-call "REQUEST.set('filename' , 'test.pdf')" >
<dtml-call "REQUEST.set('file_id' , _.string.split(filename,'.'))" >
<dtml-var file_id>
with view I get ['test','pdf']
2>>>mydtml_method.html:
<dtml-call "REQUEST.set('filename' , 'test.pdf')" >
<dtml-call "REQUEST.set('file_id' , _.string.split(filename,'.pdf'))" >
<dtml-var file_id>
with view I get ['test','']
This make a invalide id for my PDFclass instance.
I don't know how to separate the 2 arguments of file_id.
Thanx
()
/ \
| <> |
(____) zazen rules ... Sbaline
_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/