Re: [SQLObject] default empty dict for picklecol
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2009-01-26 08:50:07
|
On Sun, Jan 25, 2009 at 08:35:03PM -0800, Daniel Fetchinson wrote: > When using a PickleCol with default={ } the behaviour is not exactly > what I would expect: > > ###################################################################### > from sqlobject import * > sqlhub.processConnection = connectionForURI( 'sqlite:///:memory:', debug=True ) > class t( SQLObject ): > x = PickleCol( default={} ) > t.createTable( ) > row = t( ) > print row.x # this will print None > ###################################################################### > > Having a non-empty dict works as expected though. I had a feeling it > was related to mutable keyword argument values and the associated > problems, but the same problem is there with an empty tuple which is > certainly unmutable. > > Is this a bug or a feature? Seems like a bug related to boolean testing of objects. I.e., somewhere there is a code that does if object:... instead of if object is None:... But a quick glance at PickleCol code didn't reveal a clue. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |