[Twisted-Python] question about setSubmodel in web.woven.model

vicky lupien vlupien at drummonddesigns.com
Thu Oct 23 13:50:27 EDT 2003


I took a look in the class Model in the module model and I found one
difference.  A part of the code is gone in the function setSubmodel.
 
Original code:
 
def setSubmodel(self, request=None, name=None, value=None):
        """
        Set a submodel on this model. If getSubmodel or lookupSubmodel
        ever return a Deferred, I ought to set this in a place that
        lookupSubmodel/getSubmodel know about, so they can use it as a
        cache.
        """
        if value is None:
            warnings.warn("Warning! setSubmodel should now take the
request as the first argument")
            value = name
            name = request
            request = None
 
        if self.submodelCheck(request, name):
            if self.submodels.has_key(name):
                del self.submodels[name]
            setattr(self, name, value)
 
and here's the new code:
 
def setSubmodel(self, request=None, name=None, value=None):
        """
        Set a submodel on this model. If getSubmodel or lookupSubmodel
        ever return a Deferred, I ought to set this in a place that
        lookupSubmodel/getSubmodel know about, so they can use it as a
        cache.
        """
 
        if self.submodelCheck(request, name):
            if self.submodels.has_key(name):
                del self.submodels[name]
            setattr(self, name, value)
 
Now I tried to run my application and I got this error :
exceptions.TypeError: cannot concatenate 'str' and 'NoneType' objects
When I add the missing part of code, everything is alright.  I look in
my own code and I'd never call the function setSubmodel, so I wanna
know if the error is somewhere else in the twisted code.
 
Vicky
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20031023/eb38ef4c/attachment.htm 


More information about the Twisted-Python mailing list