Package orm2 :: Module containers :: Class _container
[hide private]
[frames] | no frames]

Class _container

source code

    object --+        
             |        
      property --+    
                 |    
datatypes.datatype --+
                     |
                    _container
Known Subclasses:
sqldict, sqltuple

Instance Methods [hide private]
  __init__(self, child_relation, child_column, child_key=None, title=None)
@param child_relation: sql.relation object or string, indicating the name of the dependent relation.
  __init_dbclass__(self, dbclass, attribute_name)
This methods gets called by dbobject's metaclass.
  __set_from_result__(self, ds, dbobj, value)
A container is not selected from a result.
  __convert__(self, value)
Containers do not need a convert method or can't use it anyway.
  sql_literal(self, dbobj)
This container cannot be represented as an SQL literal.
  __select_this_column__(self)
  __select_after_insert__(self, dbobj)
  child_where(self, dbobj)
A where clause that leads to all the rows in the child table associated with this parent table.

Inherited from datatypes.datatype: __delete__, __get__, __set__, __setattr__, add_widget, check_dbobj, data_attribute_name, isset, widget_specs

Inherited from property: __getattribute__, __new__

Inherited from object: __delattr__, __hash__, __reduce__, __reduce_ex__, __repr__, __str__


Class Variables [hide private]

Inherited from datatypes.datatype: python_class, sql_literal_class

Inherited from property: fdel, fget, fset


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, child_relation, child_column, child_key=None, title=None)
(Constructor)

source code 

@param child_relation: sql.relation object or string, indicating
   the name of the dependent relation.
@param child_column: It's datatype (datatype object). The datatype's
   column parameter may be used as well as teh validators. Title and
   has_default will be ignored. The column name defaults to the
   container's attribute_name in the parent dbclass.
@param child_key: A string indicating the column in the child
   relation that is used in the foreign key to point to the parent.
   
The the docstrings of the actual implementations for examples,
that's going to make it clearer.

As a sidenote: This only works for a single-column reference
key from the parent class to the child class. It would be
possible implementing this for multiple column keys using an
anonymous dbclass, but it's just soooo darn complicated! So I
thought to myself that orm2 is complecated enough...

Overrides: datatypes.datatype.__init__

__init_dbclass__(self, dbclass, attribute_name)

source code 
This methods gets called by dbobject's metaclass. It supplies the db property with info about the class it belongs to and its attribute name.
Overrides: datatypes.datatype.__init_dbclass__
(inherited documentation)

__set_from_result__(self, ds, dbobj, value)

source code 
A container is not selected from a result.
Overrides: datatypes.datatype.__set_from_result__

__convert__(self, value)

source code 
Containers do not need a convert method or can't use it anyway.
Overrides: datatypes.datatype.__convert__

sql_literal(self, dbobj)

source code 
This container cannot be represented as an SQL literal.
Returns:
SQL literal as a string.
Overrides: datatypes.datatype.sql_literal

__select_this_column__(self)

source code 
Returns:
False. Containers do not need to select anything.
Overrides: datatypes.datatype.__select_this_column__

__select_after_insert__(self, dbobj)

source code 
Returns:
False. Containers to not need to select anything, even after the insert.
Overrides: datatypes.datatype.__select_after_insert__

child_where(self, dbobj)

source code 
A where clause that leads to all the rows in the child table associated with this parent table.