[Twisted-Python] Re: [Twisted-commits] Make the previous patch a little lazier by only getting the model if it's really needed
Andrew Bennetts
andrew-twisted at puzzling.org
Thu Sep 26 20:12:29 EDT 2002
On Thu, Sep 26, 2002 at 01:41:48PM -0500, dp CVS wrote:
> Modified files:
> Twisted/twisted/web/woven/view.py 1.5 1.6
>
> Log message:
> Make the previous patch a little lazier by only getting the model if it's really needed
[..snip..]
> + def getNodeModel(self, submodel):
> + if submodel:
> + modelGetter = DefaultWidget(self.model)
> + modelGetter.setSubmodel(submodel)
> + model = modelGetter.getData()
> + else:
> + model = None
> + return model
[..snip..]
> else:
> # If no "controller" attribute was specified on the node, see if
> # there is a IController adapter registerred for the model.
> + model = self.getNodeModel(submodel)
> controllerFactory = components.getAdapterClassWithInheritance(
> model.__class__,
> mvc.IController,
> controllerFactory)
Isn't this going to barf when someone passes None (or other false
values) for submodel to getNodeController in Python 2.1? You can't do
None.__class__ in 2.1.
I've never used woven (or any of its previous incarnations) so I'm quite
willing to accept that I might be wrong about this :)
-Andrew.
More information about the Twisted-Python
mailing list