Difference between C and Python versions of TemplateDict?
Hi Zope-Devvers, Anyone have experience with the below kind of problem? I'm working on trying to make a Product which is reference-able using an in tag, like: <!--#in myProduct--> <!--#var myvalue--> <!--#/in--> I've made a Product along these lines: class MyProduct( Acquisition.Implicit, Persistent, AccessControl.Role.RoleManager, OFS.SimpleItem.Item): def __init__(self): self.items = [MyItem(1), MyItem(2), MyItem(3)] def __call__(self, *args, **kw): return self.items def __len__(self): return len(self.items) def __getattr__(self, index): return self.items[index] class MyItem: def __init__(self, v): self.myvalue = v When I include the above <!--#in--> DTML in a document and view it, it gives a TypeError (2 args expected instead of 1) on the following line in DocumentTemplate.DT_In.renderwob: sequence=md[name] However, the exact same code works if I change DT_Util.py so that it uses pDocumentTemplate instead of cDocumentTemplate for the TemplateDict class definition. What's going on here? Is there some difference in the way this lookup is being done in pDocumentTemplate.TemplateDict and cDocumentTemplate.TemplateDict? I'm doing my best to understand what's going on on my own, but if anyone has an easy solution please spin it my way! Document Templatingly yours, -Brian Hooper
participants (1)
-
Brian Hooper