[Zope] best way to define variables for form parameterization ?

Meilicke, Scott scott.meilicke@intp.com
Fri, 17 Aug 2001 10:41:35 -0700


Assign properties to the appropriate folders.  Just as Title is a property,
you can create a property called orgloc and assign it a value.  You can get
to properties from the manage screen.  Click into a folder, click the
properties tab.

Scott

-----Original Message-----
From: Mitchell L Model [mailto:mlm@acm.org]
Sent: Friday, August 17, 2001 10:37 AM
To: zope@zope.org
Subject: [Zope] best way to define variables for form parameterization?


What's the best way to define variables to be used in a parameterized 
DTML document?

Let's say I have a folder hierarchy where all the folders can share a 
single index_html at the root, except that there are a couple of 
differences in various places that are not directly derivable from 
the usual variables (id, title, etc.).  For instance, an organization 
chart represented as a folder hierarchy, and a standard welcome page 
that includes among other things the physical location of the part of 
the organization represented by the selected folder and the phone 
number of the receptionist at that location.  My index_html page 
could have
	<dtml-var orgloc>
and
	<dtml-var receptPhone>
buried in it somewhere, then all I have to do is define orgloc and 
receptPhone at appropriate places in the folder hierarchy.  I could 
of course make them DTML Methods that just returned a string, but it 
seems pretty heavy-handed to define a method just to get a variable 
value.  Is there a better way to specify variable values?  Some kind 
of dictionary mechanism?  Suppose I had 10 or 20 such variables -- I 
wouldn't want to deal with the proliferation of one-line DTML Methods 
throughout the hierarchy.  I just want a way for each folder to 
register values of whatever variables it wants to override, for use 
by parameterized pages.

One thought I had was to subclass ObjectManager (either in Python or 
as a ZClass) and add a mechanism that looks in a dictionary stored in 
a "variables" instance variable, then if the desired variable wasn't 
there, look at the parent, etc.

Before I launch off into this escapade, please tell me if (a) there's 
a straightforward way to define variables like this; (b) the whole 
idea is confused; or (c) there's an available Product for this.

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