July 19th, 2013, 09:16 PM
WTForms self.form.process obj= always None
my problem is that even after passing in a custom object and confirming that it is not None it appears to be None when logging info on form.py
def process(self, formdata=None, obj=None, **kwargs):
Any idea why its None by the time it gets to teh obj argument but not None before?
currently trying to use form mixins :
blain = models.bla.get_All_byefg(efg.key)
cbla = blablaclass(efg,blain )
class blablaclass(object): def __init__(self, efg, abc): self.abc=abc
class blaMixin(BaseForm): efg= fields.FormField(blaMixin)
July 19th, 2013, 09:45 PM
I have no idea what library this is and you didn't provide much context for discussion... That said...
You checked that the object actually exists at the label you gave it. So it might be that the function you are passing it to is asking the object a question that its answering None to, instead of the object itself actually being a NoneType.
>>> def get_name(o):
... print o.name
>>> class Mine(object):
... def __init__(self, name=None):
... self.name = name
>>> c = Mine()
The object named "c" exists, buts its name was initialized to None by default (whoops!) -- and when asking get_name() to tell us the name its saying "None" -- which could make it appear that c itself is None if we don't understand what is going on within get_name() and c.
I'm not sure that this is what's going on, but it might be a good idea to check some of the code in the class/method soup you're swimming in, since it sounds like you're certain your object does indeed exist (and if it didn't exist at all you'd get a name error).