PStorBaseObject - shmolyneaux/SquareJam GitHub Wiki
PStorBaseObject is an abstract class within pstorage which Lists, Dicts, and Objects are derived from.
The class contains the following members:
__reserved__
__key__
__connection__
__root__
__container__
It also contains the following methods:
canonicalname
Dict
List
uri2py
islink
__eq__
Members
__reserved__
is a list of strings containing the names of the members and methods in the previous two lists. This is used to insure that the values are not overwritten.
__key__
is a string containing the location of the object. For example the index
attribute of _0_0_0_0
is Server/WebSites/_0_0_0_0/index
.
__connection__
is a StorservConnection object. Important members of this class are __username__
and __sessIP__
to get the user's name, and the user's IP, respectively.
__root__
should be the Storage object at the root of the database this is currently an issue.
__container__
is the object that the current object is contained within.
Methods
canonicalname( key=None )
- returns
__key__
if key equates to None, else it returnskey
. This is used mainly for throwing exceptions within pstorage.
Dict( key=None )
- convenience method to instantiate and return a new
Dict
type object with a given key.
List( key=None )
- convenience method to instantiate and return a new
List
type object with a given key.
uri2py( path )
- returns an attribute from a URI (similar to a URL). Example:
self.uri2py('_0_0_0_0/index/html')
would return thehtml
Method
ifself
is theWebSites
Object
.
islink()
- returns true if the object is a link to another object.
eq( other )
- objects equate when they have the same
__key__
.