An implementation (not tested) of the PVVMember class.
This commit is contained in:
parent
5cb46c61d8
commit
46c6155b2b
|
@ -26,15 +26,17 @@ class PVVMember(dict):
|
||||||
# Populate the object with the fields and values provided in the
|
# Populate the object with the fields and values provided in the
|
||||||
# `data' object. `dbref' is a pointer to the PVVDB instance that
|
# `data' object. `dbref' is a pointer to the PVVDB instance that
|
||||||
# created the PVVMember instance.
|
# created the PVVMember instance.
|
||||||
pass
|
dict.__init__(self, data)
|
||||||
|
self.dbref = dbref
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
# Synchronise the object to disk via the database interface.
|
# Synchronise the object to disk via the database interface.
|
||||||
pass
|
self.dbref.save(self)
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
# Update the object with the data on disk.
|
# Update the object with the data on disk.
|
||||||
pass
|
o = self.dbref.load(data)
|
||||||
|
self.update(o)
|
||||||
|
|
||||||
def is_saved(self):
|
def is_saved(self):
|
||||||
# Checks whether the objects need to be saved or loaded.
|
# Checks whether the objects need to be saved or loaded.
|
||||||
|
@ -118,7 +120,7 @@ class PVVDB:
|
||||||
# we should not be here
|
# we should not be here
|
||||||
raise PVVDBError, "%s not legal datatype." % `self.format[key]`
|
raise PVVDBError, "%s not legal datatype." % `self.format[key]`
|
||||||
member[key] = value
|
member[key] = value
|
||||||
return PVVMember(member, username)
|
return PVVMember(member, self)
|
||||||
|
|
||||||
def save(self, username, comment="", lock=False):
|
def save(self, username, comment="", lock=False):
|
||||||
# Write the record to the database. Will automatically unlock
|
# Write the record to the database. Will automatically unlock
|
||||||
|
|
Reference in New Issue