Changeset 141 for elixir/trunk/elixir/relationships.py
- Timestamp:
- 07/04/07 14:36:56 (6 years ago)
- Files:
-
- 1 modified
-
elixir/trunk/elixir/relationships.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
elixir/trunk/elixir/relationships.py
r139 r141 312 312 313 313 def match_type_of(self, other): 314 t1, t2 = type(self), type(other) 315 316 if t1 is HasAndBelongsToMany: 317 return t1 is t2 318 elif t1 in (HasOne, HasMany): 319 return t2 is BelongsTo 320 elif t1 is BelongsTo: 321 return t2 in (HasMany, HasOne) 322 else: 323 return False 314 return False 324 315 325 316 def is_inverse(self, other): … … 357 348 super(BelongsTo, self).__init__(entity, name, *args, **kwargs) 358 349 350 def match_type_of(self, other): 351 return isinstance(other, (HasMany, HasOne)) 352 359 353 def create_keys(self): 360 354 ''' … … 448 442 if self.primaryjoin_clauses: 449 443 kwargs['primaryjoin'] = and_(*self.primaryjoin_clauses) 444 450 445 kwargs['uselist'] = False 451 446 452 447 self.property = relation(self.target, **kwargs) 453 448 self.entity.mapper.add_property(self.name, self.property) … … 456 451 class HasOne(Relationship): 457 452 uselist = False 453 454 def match_type_of(self, other): 455 return isinstance(other, BelongsTo) 458 456 459 457 def create_keys(self): … … 522 520 super(HasAndBelongsToMany, self).__init__(entity, name, 523 521 *args, **kwargs) 522 523 def match_type_of(self, other): 524 return isinstance(other, HasAndBelongsToMany) 524 525 525 526 def create_tables(self):
