Hi I have a variable `x' ,
type is `instance' -record-,
was created with something like

I want to add a new attribute `attr2', in Zope
something similar with:<dtml-call "REQUEST.set('var',Expresion)">
(python ) x.attr2=VALUE2
but the assign operator `=' is not allowed in Python expresion,
so I can not call <dtml-call "x.attr2=VALUE2">

So I try:
<dtml-call "x.__dict__.update({'attr2':'attrValue'})">
(the expresion in Python is (VERY) correct)

When I try to save the DTML-METHOD ,
(NOT at the EXECUTION time), I get the error:

  File /usr/lib/zope/lib/python/DocumentTemplate/DT_Util.py, line 357, in
    (Info: ({'': '&quot;x.__dict__.update({\'attr\':\'attrValue\'})&quot;'},
'call', 1, 'name'))
  File /usr/lib/zope/lib/python/DocumentTemplate/VSEval.py, line 175, in
    (Object: x.__dict__.update({'attr':'attrValue'}))
TypeError: illegal name used in expression

I have take a look at VSEval.py,
and looks like  I can not use names that are starting with `_'
and are  not in ('_', '_vars', '_getattr')

How can I add a new attribute to a variable?
I can do this with an external method,
but maybe exist other way...


"Will I be using Python today?"
 and if the answer is "yes"
 I know that it's going to be a good day.

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

Reply via email to