Now how a working load function. A bit hackish since it now chdirs into
the database directory.
This commit is contained in:
parent
782191573e
commit
6dfee80fff
|
@ -100,12 +100,13 @@ class PVVDB:
|
|||
def load(self, username, lock=False):
|
||||
# Read the record from the database. Will do an automatic lock
|
||||
# if `lock' is True.
|
||||
rv = self.rcs.checkout(
|
||||
self.__filename(username), lock)
|
||||
userfile = file(self.__filename(username))
|
||||
cwd = os.getcwd()
|
||||
os.chdir(self.base)
|
||||
rv = self.rcs.checkout(username + ",v")
|
||||
userfile = file(username)
|
||||
os.chdir(cwd)
|
||||
member = {}
|
||||
for line in userfile:
|
||||
print line
|
||||
key, value = line.strip().split(": ", 1)
|
||||
if not key in self.format:
|
||||
raise PVVDBError, "%s not a legal attribute." % `key`
|
||||
|
@ -121,7 +122,7 @@ class PVVDB:
|
|||
else:
|
||||
# we should not be here
|
||||
raise PVVDBError, "%s not legal datatype." % `self.format[key]`
|
||||
member[key] = value
|
||||
member[key] = v
|
||||
return PVVMember(member, self)
|
||||
|
||||
def save(self, username, comment="", lock=False):
|
||||
|
|
Reference in New Issue