Objects - shmolyneaux/SquareJam GitHub Wiki
Object inherits from PStorBaseObject, and is the parent class of Method.
This class contains the following methods:
__init__
__setattr__
__delattr__
getcontents
getattributes
getncontents
getnrcontents
hasattr
__getattribute__
__str__
__repr__
keys
get__key__
update_handler
Method
Members
The Object class appends the above list of methods names to __reserved__
from PStorBaseClass with the exception of keys
, get__key__
, and update_handler
.
Methods
_init_( connection, key )
- creates a reference object that refers to a mutable object in the persistent storage system.
_setattr_( name, value )
- sets the attribute
name
tovalue
.
_delattr_( attr )
- deletes the attribute
attr
.
getattributes()
- returns a list of the names of a Object's attributes.
getcontents()
- returns a list containing the
__key__
of each attribute.
getncontents()
- get a count of the contents
getnrcontents()
- get a recursive count of the contents
hasattr( attr )
- returns true if the Object has an attribute
attr
_getattribute_( self, attr, python_object=1 )
- attempts to return the value of
attr
. It first looks for the attribute in the database, then it looks for the attribute in the Object's Class (which is still on the database). If the attribute is not in either of those it looks for the attribute in the python object itself.
_str_()
- returns
Object(%s)
where%s
isrepr(self.__key__)
.
_repr_()
- functional the same as
__str__
.
keys()
- not fully implemented.
get__key__()
- returns
__key__
.
update_handler( name )
- a method meant to be overwritten. Called when the value of attribute is modified.
name
is the attribute that was modified.
Method( key=None )
- convenience method to instantiate and return a new Method type object with a given key.