[Zope-dev] Calendar tag 0.9.6 breaks with 2.2.0b3??
Dr. Ross Lazarus
rossl@med.usyd.edu.au
Thu, 29 Jun 2000 12:16:25 +1000
Thanks for the help.
Summary:
CalendarTag works fine in 2.1.6 but is broken in 2.20b3.
__call__ is mapped to render(self,md) - this is the same for all dtml
tags AFAIK.
The point that I find hard to understand is that namespace in DT_Util
has changed from 2.1.6 as follows
===========2.1.6==================
class namespace_:
pass
def namespace(self, **kw):
"""Create a tuple consisting of a single instance whos attributes
are
provided as keyword arguments."""
r=namespace_()
d=r.__dict__
for k, v in kw.items(): d[k]=v
return r,
========2.2.0b3============
class namespace_:
__allow_access_to_unprotected_subobjects__=1
def namespace(self, **kw):
"""Create a tuple consisting of a single instance whos attributes
are
provided as keyword arguments."""
return apply(self, (), kw)
Now, I can easily put the old definition back and it might work - but
I'm not in a position to understand why the method has changed from what
looks like a simple dictionary construction to the apply function -
which doesn't seem to have anything to do with the namespace_ class !!
Brian??
Dieter Maurer wrote:
> The "self", more precisely, its "__call__" gets the keyword
> "linkDate" which it does not (no longer) likes to have.
>
> Dr. Ross Lazarus writes:
> > Trying the new 2.2.0b3 zope.
> > One zclass using ty's calendar tag now breaks with an error message I
> > just cannot figure out -
> >
> > Error Type: TypeError
> > Error Value: unexpected keyword argument: linkDate
> >
> > File /usr/local/zope/zope22b3/lib/python/DocumentTemplate/DT_Util.py,
> > line 262, in namespace
> > TypeError: (see above)
> >
> > I added __allow_access_to_unprotected_subobjects__=1 to the CalendarTag
> > class just in case.
> >
> > The offending line in CalendarTag.py is
> >
> > ns = namespace(self,
> > date = date,
> > mode = self.mode,
> > firstday = firstday,
> > setCalendar = self.setCalendar_,
> > getCalendar = self.getCalendar_,
> > linkDate = self.linkDate_
> > )[0]
> >
> >
> > namespace in DT_Util seems harmless enough -
> >
> > def namespace(self, **kw):
> > """Create a tuple consisting of a single instance whos attributes are
> > provided as keyword arguments."""
> > return apply(self, (), kw)
> The "self", more precisely, its "__call__" gets the keyword
> "linkDate" which it does not (no longer) likes to have.
>
> Dieter