2 from wiki import settings
5 class DocumentStorage(object):
6 def __init__(self, path):
7 self.vstorage = vstorage.VersionedStorage(path)
9 def get(self, name, revision=None):
11 text = self.vstorage.page_text(name)
13 text = self.vstorage.revision_text(name, revision)
14 return Document(self, name=name, text=text)
16 def put(self, name, document, author, comment, parent):
17 self.vstorage.save_text(document.name, document.text, author, comment, parent)
19 def delete(name, author, comment):
20 self.vstorage.delete_page(name, author, comment)
23 class Document(object):
24 def __init__(self, storage, **kwargs):
25 self.storage = storage
26 for attr, value in kwargs:
27 setattr(self, attr, value)
30 storage = DocumentStorage(settings.REPOSITORY_PATH)