Hi guys!
My project has a need for has_and_belongs_to_many to accept
uselist=False (as the documentation says that it should) so that
has_and_belongs_to_many can be used to represent bidirectional 1-to-1
relationships. In the current Elixir code, elixir/relationships.py's
HasAndBelongsToMany.create_properties() passes uselist=True, causing a
duplicate keyword exception if client code also passes the uselist
keyword. The following patch has, I believe, the intended semantics:
uselist=True is taken to be the default, but will be updated with the
passed keyword argument. If this could be reviewed and, hopefully,
accepted, I'd be extremely grateful.
Best regards,
Paul Snively
---------------------------------------------cut
here---------------------------------------------
Index: elixir/relationships.py
===================================================================
--- elixir/relationships.py (revision 135)
+++ elixir/relationships.py (working copy)
@@ -660,8 +660,9 @@
kwargs['order_by'] = \
self.target._descriptor.translate_order_by(kwargs['order_by'])
- self.property = relation(self.target,
secondary=self.secondary_table,
- uselist=True, **kwargs)
+ _meh = {"secondary": self.secondary_table, "uselist": True}
+ _meh.update(kwargs)
+ self.property = relation(self.target, **_meh)
self.entity.mapper.add_property(self.name, self.property)
def is_inverse(self, other):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---