Re: [SQLObject] Hook for .new() method?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Edmund L. <el...@in...> - 2003-06-26 22:37:08
|
Ian Bicking wrote:
> Just with new, like:
>
> def new(cls, **kw):
> obj = super(cls).new(**kw)
> # ... do stuff ...
> return obj
> new = classmethod(new)
>
>
> On Mon, 2003-06-09 at 00:06, Edmund Lian wrote:
>
>>What's the best way to hook some code into the .new()? Basically, I need
>>to run some code after an object is instantiated for the first time. Is
>>this what the _init() method is for?
Hmmm... This doesn't seem to work. When I do this, I get an AttributeError:
obj = super(cls).new(**kw)
AttributeError: 'super' object has no attribute 'new'
I know that there are some bugs in the super method of Python 2.2. Is
this one of them? If so, how can I work around it?
...Edmund.
|