[Zope] how do i escape a name with . in it?

Casey Duncan casey@zope.com
10 Jun 2002 13:36:35 -0400


On Mon, 2002-06-10 at 10:25, Navindra Umanee wrote:
> Bakhtiar A Hamid <kedai@kedai.com.my> wrote:
> > i think we need to pass the client, and mapping
> > still untested
> >  <dtml-in 
> > expr="_['dot.kde.org'](_.None,_)(sort_on='date',sort_order='reverse')"
> >  size=40>
> > 
> > which is ugly, methinks
> 
> Ugliness has never been a concern! If only I could get it to
> work... :-)
> 
>   <strong>Error Type: AttributeError</strong><br>
>   <strong>Error Value: no __call__ method defined</strong><br>
[snip]

_['foo'] is somewhat magical and tries to call the object named foo. So
you are actually calling foo and then the result of foo by writing:
_['foo'](_.None, _). Instead use getitem:

_.getiem('some.dotted.name')(_.None, _, arg1=bar, arg2=spam, ...)

assuming some.dotted.name is a DTML object. It would be slightly less
messy to write a python script that did this call for you, but then you
would have more objects to take care of...

hth,

-Casey