Using fmt= with External Method
I have not seen any documentation on this, so I'm definitely fumbling in the dark here. Please bear with me. I'm curious if it's possible to use the fmt= syntax with external methods. Basically, let's assume I have this piece of DTML: <!--#var Heading fmt=HeadingFormat--> If I add an External Method called HeadingFormat, that method should be called to format Heading, right? Well, this works partially, except that HeadingFormat() cannot take any parameters. Any reason for this? How, then, can I access the data to format? Looking at the code in DT_Var.py: if hasattr(val, fmt): print "calling %s" % fmt #!! val = getattr(val,fmt)() elif special_formats.has_key(fmt): val = special_formats[fmt](val, name, md) elif fmt=='': val='' else: val = fmt % val Shouldn't the line val = getattr(val,fmt)() say something like val = getattr(val,fmt)(val) instead? (Implementing the above patch seems to work, but is likely to break lots of things?) Did I miss something? Since chances are this is the case :-), how then do I implement a method to format arbitrary objects without actually modifying the Zope sources? -- Alexander Staubo http://www.mop.no/~alex/ "`This must be Thursday,' said Arthur to himself, sinking low over his beer, `I never could get the hang of Thursdays.'" --Douglas Adams, _The Hitchhiker's Guide to the Galaxy_
participants (1)
-
Alexander Staubo