Fix some formatting.
This commit is contained in:
parent
9b3c019edb
commit
bd92d82219
|
@ -5,7 +5,7 @@
|
|||
# itself while defining objects that the database will return.
|
||||
#
|
||||
|
||||
import rcs, re
|
||||
import rcs, os
|
||||
|
||||
|
||||
#
|
||||
|
@ -50,11 +50,19 @@ class PVVDB:
|
|||
def __init__(self, base):
|
||||
# Find the record definition file, read it, verify it and
|
||||
# set the legal set of fields.
|
||||
pass
|
||||
self.base = base # base database directory
|
||||
self.locks = [] # list of activated locks
|
||||
self.rcs = rcs.RCS() # an RCS interface function
|
||||
|
||||
def __del__(self):
|
||||
# clean up locks and such before being deleted.
|
||||
pass
|
||||
for username in self.locks:
|
||||
self.rcs.unlock(username)
|
||||
|
||||
def __filename(self, username):
|
||||
# transform the username into a tuple with the full name of
|
||||
# the databasefile and the latest revision number.
|
||||
return self.rcs.rcsname(os.path.join(self.base, username))
|
||||
|
||||
def __format(self, file_path):
|
||||
# parses and verifies the .format files for a database.
|
||||
|
@ -70,11 +78,15 @@ class PVVDB:
|
|||
fmt[name] = value
|
||||
return fmt
|
||||
|
||||
def lock(self, username):
|
||||
def lock(self, username, pedantic=False):
|
||||
# Lock the record.
|
||||
pass
|
||||
if username in self.locks and pedantic:
|
||||
raise PVVDBError, "%s already locked." % `username`
|
||||
self.rcs.lock(self.__filename(username))
|
||||
self.locks.append(username)
|
||||
|
||||
def unlock(self, username):
|
||||
|
||||
def unlock(self, username, pedantic=False):
|
||||
# Unlock the record.
|
||||
pass
|
||||
|
||||
|
|
Reference in New Issue