[Zope] Newbie: Python:Path Troubles

Dieter Maurer dieter@handshake.de
Thu, 11 Jul 2002 21:41:04 +0200


Rebecca.R.Hepper@seagate.com writes:
 > I am trying to use python:path in a html form to get a path name which I
 > will pass to a python script and use the setDescription function on.
What is the "path name"? Do you mean the "URL"?

 > ...
 > If I print my python:path
 > statement into a table header I get something like:  "<PortalFolder
 > instance at 90a24a0>"
 > ...
 > <td><input type="hidden" name="folderPath"
 >     value="folderPath"
 >     tal:attributes="value python:path('root/MyPortal/folderA/%s' %
 > folderID)"></td>
This is exactly, how "path" should work:

     It turns a path into an object, in this case into a "PortalFolder"
     object.

     As the generated HTML can only contain strings, ZPT calls
     the "str" method on the object. This results in
     "<PortalFolderI instance at ...>".

What you need to do:

     Pass the path string itself as value of the hidden variable.
     Use "restrictedTraverse" in you Python Script to resolve it
     into an object.
     Call "setDescription" on this object.


Dieter