[Zope] DTML parameter to Python script
zope at dylanreinhardt.com
Fri Oct 3 10:44:14 EDT 2003
On Fri, 2003-10-03 at 03:23, Michael Bleijerveld wrote:
> Hi Dylan,
> When one of the links is pressed I need the name of the selected link
> (directoryname) for displaying the files in this directory.
> - Documents
> - Pictures
> - Movies
> How can I use a Python script to set the current directory ?
Well... the easiest thing is to design so that you don't need to do
anything. For example, let's say you have the directory structure:
Where list_contents is a DTML Method like:
<dtml-in "objectIds(object_type)" prefix=obj>
Now, if you want list_contents to apply to a specific directory, you
need only cause the client to request a URL like:
It is not usually necessary to *set* the current directory if you let
Acquisition respond in the context of the client request.
If you need to use an object that regular Acquisition isn't going to
find correctly, you can use restrictedTraverse() or dtml-with.
More information about the Zope