[sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative

2015-08-14 Thread Eric Atkin
Hi, I've written a class decorator to define a boilerplate __init__ on some of my models that inherit from a declarative_base superclass. The problem is that sqlalchemy.orm.instrumentation._generate_init() has already installed an __init__ and when I overwrite that, things break with object

Re: [sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative

2015-08-14 Thread Mike Bayer
this code is incorrect from a Python perspective. You're removing the original `__init__` method entirely and it is never called; the attempt to call it using super() just calls object.__init__. SQLAlchemy is already decorating the __init__ method of the mapped class so you can't just throw

Re: [sqlalchemy] Overwriting __init__() after class definition breaks sqlalchemy with declarative

2015-08-14 Thread Eric Atkin
This works. Thank you for the quick response and great libraries (I use Mako as well). Eric On Fri, Aug 14, 2015 at 9:07 AM, Mike Bayer mike...@zzzcomputing.com wrote: this code is incorrect from a Python perspective. You're removing the original `__init__` method entirely and it is never