line 21 creates an AssociationBase passing two arguments to the constructor, 
but AssociationBase has no __init__ and accepts no arguments.

I'd strongly recommend using pdb to track down issues like these.




On Oct 2, 2011, at 5:26 AM, Ahmed wrote:

> I am looking at 
> http://www.sqlalchemy.org/trac/browser/examples/generic_associations/discriminator_on_association.py
> and trying to adapt the example to one that is generic and can be
> reused. So I attempted to abstract all the classes. However there
> seems to be an error in the __new__ function of the creator object.
> 
> CODE is here
> http://pastebin.com/4DyK47r3
> 
> ERROR is here:
> Traceback (most recent call last):
> File "sqlalchemyex.py", line 136, in <module>
>    zip="95732")
> File "<string>", line 4, in __init__
> File "/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/orm/state.py", line 111, in
> initialize_instance
>    return manager.events.original_init(*mixed[1:], **kwargs)
> File "/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/ext/declarative.py", line 1378,
> in _declarative_constructor
>    setattr(self, k, kwargs[k])
> File "/home/ahmed/dev/pyrenv/lib/python2.6/site-packages/
> SQLAlchemy-0.6.6-py2.6.egg/sqlalchemy/ext/associationproxy.py", line
> 195, in __set__
>    setattr(obj, self.target_collection, creator(values))
> File "sqlalchemyex.py", line 28, in <lambda>
>    discriminator=discriminator)
> TypeError: object.__new__() takes no parameters
> 
> 
> Can anyone please help me understand what am I doing wrong? I guess if
> I know what's causing the error, then the code after some polishing
> will be a good candidate to include in the SQLalchemy recipes.
> 
> Cheers,
> Ahmed
> http://stackoverflow.com/questions/7582861
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to