Package snakelegs :: Module fields :: Class BaseField
[hide private]
[frames] | no frames]

Class BaseField

object --+
         |
        BaseField
Known Subclasses:

The base class for all database field objects. You can override this class to define your own database field types.

Instance Methods [hide private]
 
__init__(self, default=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
setvalue(self, value)
Set the value that this field will hold.
 
getvalue(self)
Get the value stored in this field.
 
dbgetvalue(self)
Return the value to be sent to the database.
 
delvalue(self)
Delete the current value.
 
deferred(self)
Perform deferred initialization on this field.

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

Properties [hide private]
  value
The value held by this field.

Inherited from object: __class__

Method Details [hide private]

__init__(self, default=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

setvalue(self, value)

 

Set the value that this field will hold. You should use this method to perform validation as well. Raise a TypeError if value is of the incorrect type. By default, this method stores value in self._value

getvalue(self)

 

Get the value stored in this field. By default returns self._value

dbgetvalue(self)

 

Return the value to be sent to the database. You may find it useful to override this if your field should send its data to the user in one format and to the database in another format

deferred(self)

 

Perform deferred initialization on this field. This should be used whenever there are values that should be set when an instance of the Document object is created rather than when the Document class is created


Property Details [hide private]

value

The value held by this field.

Get Method:
getvalue(self) - Get the value stored in this field.
Set Method:
setvalue(self, value) - Set the value that this field will hold.
Delete Method:
delvalue(self) - Delete the current value.