class DocumentStorage(object):
def __init__(self, path):
self.vstorage = vstorage.VersionedStorage(path)
class DocumentStorage(object):
def __init__(self, path):
self.vstorage = vstorage.VersionedStorage(path)
if revision is None:
text = self.vstorage.page_text(name)
else:
text = self.vstorage.revision_text(name, revision)
if revision is None:
text = self.vstorage.page_text(name)
else:
text = self.vstorage.revision_text(name, revision)
def put(self, document, author, comment, parent):
self.vstorage.save_text(document.name, document.text, author, comment, parent)
def put(self, document, author, comment, parent):
self.vstorage.save_text(document.name, document.text, author, comment, parent)
def __init__(self, storage, **kwargs):
self.storage = storage
for attr, value in kwargs.iteritems():
setattr(self, attr, value)
def __init__(self, storage, **kwargs):
self.storage = storage
for attr, value in kwargs.iteritems():
setattr(self, attr, value)
-storage = DocumentStorage(settings.REPOSITORY_PATH)
+ def meta(self):
+ result = {}
+
+ m = re.match(self.META_REGEX, self.text)
+ if m:
+ for line in m.group(1).split('\n'):
+ try:
+ k, v = line.split(':', 1)
+ result[k.strip()] = v.strip()
+ except ValueError:
+ continue