On Feb 5, 4:21 pm, [EMAIL PROTECTED] wrote:
> > 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 class.__init__.func_globals['oldinit'] ?
>
> nah, i tried that, that is the globals of the module-level; while the
> locals that are inside the func... are in the .func_code. And
> especialy the outside-scope locally-bound references are
> the .func_code.co_freevars - but names only.

That's what I'm seeing as well.

>
> one way is to expose class._old__init__, or if that is not acceptable
> (which is understandable), to completely copy not only name & doc,
> but also func_defaults and the args/kwargs-names from .code - see
> inspect. But i dont think the .func_code attributes are writable, so
> they have to go under the function itself.
> A really sneaky way would be to make/fake a new code obj - well, the
> doc says "not for faint at heart" (-:
>
> now i am completely offtopic.
> ciao

If any of the following were to be included at some point, I would be
very happy:

1- class_._old_init = oldinit
2- class_.__init__._sa_oldinit = oldinit
3- class_._old_init_argspec =  inspect.getargspec(oldinit)
4- class_.__init__._sa_old_init_argspec = inspect.getargspec(oldinit)

#2 or #4 could even serve to replace the functionality of
__init__._sa_mapper_init (indicating that the class has already been
initialized)

I'd submit a patch if Michael indicates that one of them might be
accepted.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to