On 6/26/07, psnively <[EMAIL PROTECTED]> wrote:
>
> 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.

In that case the keyword has no meaning anymore. I rather suggest you
create your own relationship type (inheriting from
HasAndBelongsToMany) with whatever keyword suits you. I just commited
a little change (r136) which should make this easier.

With this change, something along the lines of:

class HasAndBelongsToOne(HasAndBelongsToMany):
    uselist = False

has_and_belongs_to_one = Statement(HasAndBelongsToOne)

shoud work. I'm not sure I want to include this in the main
distribution though. If you come up with a better name than
"HasAndBelongsToOne", I'll probably do though ;-).

-- 
Gaƫtan de Menten
http://openhex.org

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

Reply via email to