Stephan Richter wrote:

> Hello everyone,
> 
> I want to make my own name space with the following situation:
> 
> class X:
> 
>    attributes = {'foo': 'bar'}
> 
> x = X()
> 
> 
> Then I want to use it like that:
> 
> <dtml-with x>
>      <dtml-var foo>
> </dtml-with>
 >

> The result should be : bar

If you use

   <dtml-with x mapping>
     <dtml-var foo>
   </dtml-with>

You will get the result you want.

For the other stuff, look in DocumentTemplate/pDocumentTemplate.py. The 
python code is pretty clear, although the C version is what is normally 
used in Zope.

Otherwise, see DocumentTemplate/DT_Util.py and DT_With.py, or see how it 
is done in ZPatterns in Expressions.py.


By the way, I notice you posted this to [EMAIL PROTECTED] and 
[EMAIL PROTECTED] If you look in the standard footer of each email from 
both lists, you'll see this:

   **  No cross posts or HTML encoding!  **

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


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

Reply via email to