[Zope] Including Script-Generated String in Method Call
Dan Shafer
dan@gui.com
Sun, 30 Dec 2001 11:45:25 -0800
At 2:22 PM +0100 12/30/01, Emmanuel Viennet wrote:
>Dan Shafer wrote:
>
>>
>>
>>Thanks. That was informative. But it doesn't seem to work. I get an
>>AttributeError on __getslice__. The document I'm trying to render
>>and the Python script that generates the string of the URL are both
>>in the same folder as the page where this error occurs.
>>
>>I'm stumped.
>
>
>So am i :-)
>
>Is your document is a DTML Document ?
Yes, both the document I'm editing here and the one I want to load
are DTML documents.
>
>>
>>Maybe I need to make my Python script an external method?
>
>
>No, I don't think so.
>Any method returning a *string* will do the job.
>
>
>Did you try replacing yopur methoid call by a string ?
>that is, replacing
> <dtml-var "_.render(_.getattr(PARENTS[0], pagetoget ))">
>by
> <dtml-var "_.render(_.getattr(PARENTS[0], "the_name_of_your_doc" ))">
Yes, I did that. That works with the name of the file I want to load
placed inside single quotation marks.
The Python script is pretty simple and I don't see how it can be
returning a wrong result:
daynum="1"
return 'day'+daynum+'.html'
When I test that script in Zope, it returns a string of the right contents!
This is quite bewildering.
>?
>
>
>--
>Emmanuel Viennet
>Dpt GTR - IUT de Villetaneuse - Universite Paris-Nord
>93430 Villetaneuse - France
>http://www-gtr.iutv.univ-paris13.fr/
--
Dan Shafer, Author-Consultant
http://www.danshafer.com
http://www.shafermedia.com