Added functionality and (optimistic) test for check of .format files.
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
#
|
||||
# import the interface
|
||||
#
|
||||
from db import connect, disconnect
|
||||
|
||||
#
|
||||
# import the different submodules
|
||||
#
|
||||
import db, rcs
|
||||
|
||||
|
@@ -5,6 +5,9 @@
|
||||
# itself while defining objects that the database will return.
|
||||
#
|
||||
|
||||
import rcs, re
|
||||
|
||||
|
||||
#
|
||||
# The most generic exception that this library will raise.
|
||||
#
|
||||
@@ -53,6 +56,18 @@ class PVVDB:
|
||||
# clean up locks and such before being deleted.
|
||||
pass
|
||||
|
||||
def __format(self, file_path):
|
||||
# parses and verifies the .format files for a database.
|
||||
fh = file(file_path)
|
||||
fmt = {}
|
||||
for line in fh:
|
||||
if line[0] == "#":
|
||||
continue
|
||||
name, value = line.strip().split(":", 1)
|
||||
value = value.split("#", 1)[0].strip()
|
||||
fmt[name] = value
|
||||
return fmt
|
||||
|
||||
def lock(self, username):
|
||||
# Lock the record.
|
||||
pass
|
||||
@@ -76,13 +91,19 @@ class PVVDB:
|
||||
#
|
||||
# Regular interface to the database.
|
||||
#
|
||||
|
||||
pathmap = {}
|
||||
|
||||
def connect(path):
|
||||
# returns a PVVDB instance to that path. If asked for another
|
||||
# PVVDB instance with the same path as earlier, it will return
|
||||
# the same object.
|
||||
pass
|
||||
if not path in pathmap:
|
||||
pathmap[path] = PVVDB(path)
|
||||
return pathmap[path]
|
||||
|
||||
def disconnect(dbo):
|
||||
# do not do anything, really. PVVDB objects will clean up
|
||||
# automatically when deleted.
|
||||
# automatically when deleted. is here for future database
|
||||
# systems.
|
||||
pass
|
||||
|
Reference in New Issue
Block a user