diff options
author | Jason Kirtland <jek@discorporate.us> | 2007-05-03 21:51:34 +0000 |
---|---|---|
committer | Jason Kirtland <jek@discorporate.us> | 2007-05-03 21:51:34 +0000 |
commit | 76a1d1276c48cb7f3eb4186d8872b1d7915d360a (patch) | |
tree | 619a4c96bbb90ff32f03f39974fced903b63f244 | |
parent | 5606c01d391aebca903029c5a8882ea964adc566 (diff) | |
download | sqlalchemy-76a1d1276c48cb7f3eb4186d8872b1d7915d360a.tar.gz |
Oops, Python 2.5 ternary operator snuck in.
-rw-r--r-- | lib/sqlalchemy/ext/associationproxy.py | 15 | ||||
-rw-r--r-- | test/ext/associationproxy.py | 3 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py index d86297bc1..d6a995450 100644 --- a/lib/sqlalchemy/ext/associationproxy.py +++ b/lib/sqlalchemy/ext/associationproxy.py @@ -243,7 +243,10 @@ class _AssociationList(object): return len(self.col) def __nonzero__(self): - return True if self.col else False + if self.col: + return True + else: + return False def __getitem__(self, index): return self._get(self.col[index]) @@ -355,7 +358,10 @@ class _AssociationDict(object): return len(self.col) def __nonzero__(self): - return True if self.col else False + if self.col: + return True + else: + return False def __getitem__(self, key): return self._get(self.col[key]) @@ -497,7 +503,10 @@ class _AssociationSet(object): return len(self.col) def __nonzero__(self): - return True if self.col else False + if self.col: + return True + else: + return False def __contains__(self, value): for member in self.col: diff --git a/test/ext/associationproxy.py b/test/ext/associationproxy.py index c4dd78463..b6476c836 100644 --- a/test/ext/associationproxy.py +++ b/test/ext/associationproxy.py @@ -32,7 +32,6 @@ class ObjectCollection(object): class _CollectionOperations(PersistTest): def setUp(self): collection_class = self.collection_class - lazy = self.lazy if hasattr(self, 'lazy') else False metadata = BoundMetaData(db) @@ -62,7 +61,7 @@ class _CollectionOperations(PersistTest): self.name = name mapper(Parent, parents_table, properties={ - '_children': relation(Child, lazy=lazy, + '_children': relation(Child, lazy=False, collection_class=collection_class)}) mapper(Child, children_table) |