Package orm2 :: Module datatypes :: Class datatype
[hide private]
[frames] | no frames]

Class datatype

source code

object --+    
         |    
  property --+
             |
            datatype
Known Subclasses:
boolean, Float, Long, Unicode, string, integer, datetime_base, wrapper, property_group, relationships.relationship, containers._container, adapters.mysql.datatypes.binary, adapters.pgsql.datatypes.bytea, util.datatypes.pickle

This class encapsulates a dbclass' property (=attribute). It takes care of the SQL column name and the information actually stored in the database/the dbobject.

Instance Methods [hide private]
  __init__(self, column=None, title=None, validators=(), has_default=False)
  __init_dbclass__(self, dbclass, attribute_name)
This methods gets called by dbobject's metaclass.
  data_attribute_name(self)
  __get__(self, dbobj, owner="owner? Like owner of what??")
See the Python Language Reference, chapter 3.3.2.2 for details on how this works.
  __set__(self, dbobj, value)
Set the attribute managed by this datatype class on instance to value.
  __set_from_result__(self, ds, dbobj, value)
  check_dbobj(self, dbobj)
  isset(self, dbobj)
  __convert__(self, value)
Return value converted as a Python object of the class assigned to this datatype.
  sql_literal(self, dbobj)
Return an SQL literal representing the data managed by this property in dbobj.
  __select_this_column__(self)
Indicate whether this column shall be included in SELECT statements.
  __select_after_insert__(self, dbobj)
Indicate whether this column needs to be SELECTed after the dbobj has been inserted to pick up information supplied by backend as by SQL default values and auto increment columns.
  __delete__(self, dbobj)
  add_widget(self, attribute_name, widget)
  widget_specs(self)
  __setattr__(self, name, value)
x.__setattr__('name', value) <==> x.name = value

Inherited from property: __getattribute__, __new__

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


Class Variables [hide private]
  python_class = None
  sql_literal_class = None

Inherited from property: fdel, fget, fset


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, column=None, title=None, validators=(), has_default=False)
(Constructor)

source code 
Parameters:
  • column - A orm2.sql column instance or a string containing a SQL column name pointing to the column this property is responsible for. Defaults to the column with the same name as the attribute.
  • title - The title of this column used in dialogs, tables and validator error messages (among other things). This must be a unicode object or None.
  • validators - A sequence of objects of validators.validator children. (A single validator is ok, too)
  • has_default - Boolean property that determines whether this dbproperty is retrieved from the database after the dbobject has been INSERTed. (So has_default referrs to the SQL column really).
Overrides: property.__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.

data_attribute_name(self)

source code 
None

__get__(self, dbobj, owner="owner? Like owner of what??")

source code 
See the Python Language Reference, chapter 3.3.2.2 for details on how this works. Be sure to be in a relaxed, ready-for-hard-figuring mood.
Returns:
value

Overrides: property.__get__

__set__(self, dbobj, value)

source code 
Set the attribute managed by this datatype class on instance to value. This will be called by Python on attribute assignment. The __set_from_result__ method does the same thing for data retrieved from the RDBMS. See below.
Overrides: property.__set__

__set_from_result__(self, ds, dbobj, value)

source code 
None

check_dbobj(self, dbobj)

source code 
None

isset(self, dbobj)

source code 
Returns:
True, if this property is set, otherwise... well.. False.

__convert__(self, value)

source code 
Return value converted as a Python object of the class assigned to this datatype.

sql_literal(self, dbobj)

source code 
Return an SQL literal representing the data managed by this property in dbobj.
Returns:
SQL literal as a string.

__select_this_column__(self)

source code 
Indicate whether this column shall be included in SELECT statements. True by default, it will return False for most relationships.

__select_after_insert__(self, dbobj)

source code 
Indicate whether this column needs to be SELECTed after the dbobj has been inserted to pick up information supplied by backend as by SQL default values and auto increment columns.

__delete__(self, dbobj)

source code 
Overrides: property.__delete__
(inherited documentation)

add_widget(self, attribute_name, widget)

source code 
None

widget_specs(self)

source code 
None

__setattr__(self, name, value)

source code 
x.__setattr__('name', value) <==> x.name = value
Overrides: object.__setattr__
(inherited documentation)

Class Variable Details [hide private]

python_class

None
Value:
None                                                                  
      

sql_literal_class

None
Value:
None