[sqlalchemy] Re: Inspect and __init__ of a mapped class

2007-02-06 Thread Michael Bayer
sureim not super thrilled with this whole issue since id rather __init__ is just left alone, but the whole auto-add-to-the-session behavior is pretty popular...so just submit a ticket/patch for whatever version you want there. On Feb 6, 7:29 am, Patrick Lewis [EMAIL PROTECTED] wrote: On Feb

[sqlalchemy] Re: Inspect and __init__ of a mapped class

2007-02-05 Thread svilen
unless Mike puts the old_init back under the object and call self.old_init() instead of that local-ref, u can only hack the source of Mapper._compile(), either by hand staticaly or at runtime (obtain the func src, patch it, compile into python, replace the original - see that sa_hack* in

[sqlalchemy] Re: Inspect and __init__ of a mapped class

2007-02-05 Thread Sébastien LELONG
btw if u find a way to obtain some externaly-bound non-global reference from func's code (see what dis.dis() shows), DO mail... Bot sure to understand precisely what you want to do, but it seems like monkey patching: class Klass(object): def incredible_func(self): a =

[sqlalchemy] Re: Inspect and __init__ of a mapped class

2007-02-05 Thread Michael Bayer
oh right, old_init(), sorry, didnt read the first post carefully. i almost think the answer here might be to not even create the modified __init__()/old_init() method in the general case...if youre calling session.save(someobject) its not really needed. but for now...maybe

[sqlalchemy] Re: Inspect and __init__ of a mapped class

2007-02-05 Thread sdobrev
oh right, old_init(), sorry, didnt read the first post carefully. i almost think the answer here might be to not even create the modified __init__()/old_init() method in the general case...if youre calling session.save(someobject) its not really needed. but for now...maybe

[sqlalchemy] Re: Inspect and __init__ of a mapped class

2007-02-04 Thread sdobrev
I'm trying to create a mapped object where I don't know what the exact constructor arguments of the object might be. I was trying to use the inspect module to get the right arguments, but it looks like the mapper is redefining the original class __init__. Any thoughts as to how I might

[sqlalchemy] Re: Inspect and __init__ of a mapped class

2007-02-04 Thread Patrick Lewis
On Feb 4, 5:54 am, [EMAIL PROTECTED] wrote: I'm trying to create a mapped object where I don't know what the exact constructor arguments of the object might be. I was trying to use the inspect module to get the right arguments, but it looks like the mapper is redefining the original