Hi,

I was trying to follow the example I saw in the documentation for
subclassing MappedCollection (http://docs.sqlalchemy.org/en/latest/orm/
collections.html#custom-dictionary-based-collections)

However, something is wrong, because I get this error:
    super(TranslationCollection, self).__setitem__(key, value,
_sa_initiator)
TypeError:  expected 2 arguments, got 3

I simplified to:
from sqlalchemy.orm.collections import MappedCollection, collection

class TranslationCollection(MappedCollection):
    @collection.internally_instrumented
    def __setitem__(self, key, value, _sa_initiator=None):
        super(TranslationCollection, self).__setitem__(key, value,
_sa_initiator)

and still get the error.

Here's how the collection_class is configured on the relationship:
collection_class=lambda:
TranslationCollection(operator.attrgetter("language_id")

Thanks !
Béru

-- 
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