Slightly updated patch...
Index: elixir/relationships.py
===================================================================
--- elixir/relationships.py (revision 183)
+++ elixir/relationships.py (working copy)
@@ -260,11 +260,16 @@
# the relation and the backref
kwargs.pop('secondary', None)
+ # the name becomes they key; avoid duplicate
specification
+ kwargs.pop('key', None)
+
# define backref for use by the inverse
self.backref = backref(self.name, **kwargs)
return
kwargs.update(self.get_prop_kwargs())
+ # key argument is not used for relations
+ kwargs.pop('key', None)
self.property = relation(self.target, **kwargs)
self.entity.mapper.add_property(self.name, self.property)
@@ -421,7 +426,7 @@
# build the list of column "paths" the foreign key
will
# point to
- target_path = "%s.%s" % (target_desc.tablename,
pk_col.name)
+ target_path = "%s.%s" % (target_desc.tablename,
pk_col.key)
schema = target_desc.table_options.get('schema',
None)
if schema is not None:
target_path = "%s.%s" % (schema, target_path)
On Aug 14, 2:25 pm, Paul Johnston <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Well, I figured a fix that gets me going. I've got a feeling it's not
> complete though, for example, the same problem probably exists in
> HABTM. Patch is below.
>
> There was a simple test case in my earlier mail. I can look at
> incorporating these two issues into the unit tests. Not used nose
> before, but I guess it's not too hard. Any preference on what files
> you'd like me to add the tests to?
>
> Paul
>
> Index: elixir/relationships.py
> ===================================================================
> --- elixir/relationships.py (revision 183)
> +++ elixir/relationships.py (working copy)
> @@ -260,6 +260,9 @@
> # the relation and the backref
> kwargs.pop('secondary', None)
>
> + # the name becomes they key; avoid duplicate
> specification
> + kwargs.pop('key', None)
> +
> # define backref for use by the inverse
> self.backref = backref(self.name, **kwargs)
> return
> @@ -421,7 +424,7 @@
>
> # build the list of column "paths" the foreign key
> will
> # point to
> - target_path = "%s.%s" % (target_desc.tablename,
> pk_col.name)
> + target_path = "%s.%s" % (target_desc.tablename,
> pk_col.key)
> schema = target_desc.table_options.get('schema',
> None)
> if schema is not None:
> target_path = "%s.%s" % (schema, target_path)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---