Ronald Lew wrote:
> I wanted to use a mapped collection or a customized collection instead
> of the default list for the collection class and have the keyword's id
> as the key.  In addition, I wanted to keep using the append but that
> seems impossible now since I cannot fool association dict to use it.
> I wanted to not have to change the below code:
> 
> for kw in (Keyword('1','one'), Keyword('2','two'),
> Keyword('3','three')):
>     user.keywords.append(kw) # cannot use this any more

The association proxy accepts the proxy implementation type as an 
optional argument.  You can subclass the proxy dict type and add an 
append method.  See:

http://www.sqlalchemy.org/docs/04/sqlalchemy_ext_associationproxy.html#docstrings_sqlalchemy.ext.associationproxy_AssociationProxy

and:

http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/lib/sqlalchemy/ext/associationproxy.py#L227



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to