Package orm2 :: Module relationships :: Class one2many :: Class result
[hide private]
[frames] | no frames]

Class result

source code

   object --+    
            |    
_2many.result --+
                |
               one2many.result

Instance Methods [hide private]
  __init__(self, dbobj, relationship)
  select(self, *clauses)
This method allows you to add your own clauses to the SELECT SQL statement that is used to retrieve the childobjects from the database.
  len(self, *clauses)
Return the number of child objects that would be returned by the select() method using clauses.
  append(self, *new_child_objects)
Append new child objects to a one2many relationship.

Inherited from _2many.result: __getattr__, __iter__, __len__, add_where, child_class, ds, where

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, dbobj, relationship)
(Constructor)

source code 
Parameters:
  • dbobj - The dbobj our parent is a property of.
  • relationship - The parent one2many relationship.
Overrides: _2many.result.__init__

select(self, *clauses)

source code 
This method allows you to add your own clauses to the SELECT SQL statement that is used to retrieve the childobjects from the database. This works just like the datasource's select() method, with two exceptions:
  • The dbclass is the relation's childclass.
  • If you supply a WHERE clause it will be added to the WHERE clause generated by the one2many relationship using the AND conjunction. This WHERE clause is available through this class' where() method.
Example:
 country.cities.select(order_by='name')
Overrides: _2many.result.select

len(self, *clauses)

source code 
Return the number of child objects that would be returned by the select() method using clauses. Note that a call to this function will yield a SQL query seperate from the one used to actually retrieve the dbobjects. (See datasource_base.count() for details)
Overrides: _2many.result.len

append(self, *new_child_objects)

source code 
Append new child objects to a one2many relationship. Those objects must not have been inserted into the database, yet, because otherwise they would just be moved from one parent object to the other...
Overrides: _2many.result.append