| Home | Trees | Index | Help |
|
|---|
| Package bazaar :: Module assoc :: Class ObjectIterator |
|
object --+
|
ObjectIterator
Iterator of referenced objects of one-to-many and many-to-many associations.
The iterator is used to append, remove and update referenced objects, which are associated with application object.
For example, to print articles of order's items:
items = order.items # get ObjectIterator object
for oi in items:
print oi.article
Several operators are supported
len(items)
oi in items
del items[oi]
See Also: AssociationReferenceProxy
| Method Summary | |
|---|---|
Create iterator of referenced objects. | |
Check if object is referenced in the relationship. | |
Remove referenced object from association. | |
Iterator interface method. | |
Return amount of referenced objects. | |
Associate referenced object with application object. | |
Remove referenced object from association. | |
Update association data in database. | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Inherited from type | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
| Instance Variable Summary | |
|---|---|
association: Association object. | |
obj: Application object. | |
| Method Details |
|---|
__init__(self,
obj,
association)
Create iterator of referenced objects.
|
__contains__(self,
value)
Check if object is referenced in the relationship.
|
__delitem__(self,
value)
|
__iter__(self)Iterator interface method.
|
__len__(self)
Return amount of referenced objects.
|
append(self, value)Associate referenced object with application object. Method works for bi-directional associations, too:oi = OrderItem() order.items.append(oi) # oi.order == oiReferenced object cannot be None.
|
remove(self, value)Remove referenced object from association. Method works for bi-directional associations, too:order.items.remove(oi) # oi.order == Noneor: del order.items[oi] # oi.order == NoneReferenced object cannot be None.
|
update(self)Update association data in database. |
| Instance Variable Details |
|---|
associationAssociation object. |
objApplication object. |
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.0 on Sun May 23 19:11:17 2004 | http://epydoc.sf.net |