[Zope-dev] Newbie: manage_add DTML access to product variables

John Hall j.hall@f5.com
Tue, 05 Feb 2002 14:46:24 -0800


I'm fairly new to Zope and Python, so please forgive me if this is a
stupid question.  I'm trying to add a new exUserFolder authentication
plugin using LDAP.  I've copied the Radius plugin for the most part
and have almost everything working except I wanted to have a list
of possible methods (ways of using the LDAP database to authenticate
a user) that the Zope Admin chooses from on the manage_add DTML page.

I can't figure out how to keep the list in the python code for the
object where it would be easy to update when I add new methods, but
still access the list in my manage_add DTML page in a <dtml-in> loop.
When the manage_add DTML is rendered, my object does not yet exist
(the admin's response to the manage_add page is passed to a python
function that actually creates the object).

I have two questions, then.

1.  How do I format an object to use in a <dtml-in> loop?  (I'm thinking
    it needs to be a list of dict's).

2.  How do I access a function or variable in a Product's python code
    directly from DTML (or how do I add a callable method in Zope's DTML
    namespace from a Product's python code?)  I think my major problem
    here is lack of understanding of how Products are accesible within
    the DTML namespace.

Thanks in advance,
JMH