Victor Safronovich wrote:
Hello Chris Withers,

Tuesday, October 18, 2005, 4:24:29 PM, you wrote:

CW> yuppie wrote:
    def __call__(self):
        if self.isTuesday():
            return ZopeTwoPageTemplateFile('').__of__(self)()
        return self.index()

CW> Surely the following is going to be better?

CW>       tuesday_pt = ZopeTwoPageTemplateFile('')

CW>       def __call__(self):
CW>           if self.isTuesday():
CW>               return self.tuesday_pt.__of__(self)()
              IMO __of__(self) is not needing now.

Yes. Both modifications make sense. This is much faster and nicer code::

    tuesday_pt = ZopeTwoPageTemplateFile('')

    def __call__(self):
        if self.isTuesday():
            return self.tuesday_pt()
        return self.index()



Zope-CMF maillist  -

See for bug reports and feature requests

Reply via email to