[Zope] Creating a DTM Document in a variable folder.

Chris Withers chris at simplistix.co.uk
Thu Dec 1 02:40:38 EST 2005


Jonathan Cyr wrote:
> You might want to use index_html rather than index.html in this 
> example.  The dot means other things in Python, and index.html is a 
> carryover from filesystem webservers.  My impression is that the 
> acquisition mechanism doesn't like ids with a dot, in some circumstances.

Acquisition works fine irrespective of the object id.
And dotted or dashed names work fine in ZPT path:

tal:content="here/my-folder/index.html/title"

If you use python, most objectmanagers support dictionary-like notation:

tal:content="python:here['my-folder']['index.html'].title"

...and if you object doesn't support dictionary-like notation, you can 
use getattr:

getattr(getattr(here,'my-folder'),'index.html').title

And getattr performs Acquisition just fine...

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope mailing list