
So I've started to move Payago (formerly Go) towards compatibility with Nevow 0.3's API changes; the biggest impact has been the ubiquitous context, and not being able to rely on a Page having self.context. Previously, I had _many_ TypedInterfaces which did something along the lines of: class ICanDoSomething(TypedInterface): def doSomething(self, arg = Choice(choicesAttribute='choices')): pass doSomething = autocallable(doSomething) class MyPage(Page): __implements__ = ICanDoSomething def _get_choices(self): ## do something involving self.context return some_list choices = property(_get_choices) Now, with the ubiquitous context changes, self.context doesn't exist. (Makes you wonder what "ubiquitous" really means.) So there are a couple solutions that I've thought of: 1. Make annotate.Choice support 'choicesMethod', which would take context as an argument. This seems very difficult because not only webform, but Typed.coerce(), would have to be able to retrieve the context. Then we'd have to support Deferreds, because some crazy person would obviously want that at some point. ;) I tried to write a patch, and it got ugly. 2. Set self.context whenever Page.locateChild or Page.renderHTTP is called. This is a lot simpler, but it seems like a hack to me, and I'm not sure whether this will _always_ work. What do other people think? Is option #1 easier to implement than I'm thinking? Is option #2 safer than it seems to me? Is there an option #3 that I don't see right now? -- Alex Levy WWW: http://mesozoic.geecs.org/ "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_