Hi,
> > 3) I'm getting an infinite loop when I have a belong_to which is a
> > primary key, and a has_one as its inverse.
> Interesting. Test case and patch are again welcome :)
Just realised why I couldn't reproduce it - I had a temporary hack in
the Elixir source to work around. Here's the test case:
from elixir import *
class T1(Entity):
has_field('test', Integer, primary_key=True)
has_one('t2', of_kind='T2')
class T2(Entity):
belongs_to('t1', of_kind='T1', colname='bob', primary_key=True)
T1.select()
And this is the patch I'm using (not ready for commit just yet!)
Index: elixir/relationships.py
===================================================================
--- elixir/relationships.py (revision 181)
+++ elixir/relationships.py (working copy)
@@ -363,6 +363,8 @@
if self.column_kwargs.get('primary_key', False) != pk:
return
+ self.fred = 1
+
source_desc = self.entity._descriptor
#TODO: make this work if target is a pure SA-mapped class
# for that, I need:
@@ -473,7 +475,8 @@
% (self.target.__name__, self.name,
self.entity.__name__))
# make sure it is set up because it creates the foreign key
we'll need
- self.inverse.create_keys(pk)
+ if not hasattr(self.inverse, 'fred'):
+ self.inverse.create_keys(pk)
def get_prop_kwargs(self):
kwargs = {'uselist': self.uselist}
Hope this helps,
Paul
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---