[Zope] create objects with dot in product

Peter Bengtsson mail@peterbe.com
Mon, 24 Feb 2003 22:48:53 +0000


At 13:59 2003-02-24 -0500, Tim wrote:

>Via the ZMI i can create an object with a . in the name (for example,
>an object with an id 'file.htm'); how can this be done in a disk based
>product? For example, the following obviously won't work:
>
>file.htm = PageTemplateFile('www/file.htm', globals())
>
>There must be a trick, since the ZMI can do it?

class MyProduct:
         ...
         file_htm = PageTemplateFile('www/file.htm', globals())


MyProduct.__dict__['file.htm'] = MyProduct.file_htm

You basically make a new reference and this syntax allows you to do that.


>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://mail.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )