X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/b2d72160e2a68991c66ea6017b871d7f42c0b29d..5c5ef4d21bc0b4862b31b0b96aab9373357140e1:/lib/wlrepo/__init__.py diff --git a/lib/wlrepo/__init__.py b/lib/wlrepo/__init__.py index 5c27dc97..606f2d45 100644 --- a/lib/wlrepo/__init__.py +++ b/lib/wlrepo/__init__.py @@ -44,6 +44,10 @@ class Cabinet(object): else: raise ValueError("You must provide either name or doc and user.") + + def __str__(self): + return "Cabinet(%s)" % self._name + def documents(self): """Lists all documents and sub-documents in this cabinet.""" pass @@ -57,14 +61,13 @@ class Cabinet(object): as the name for the main document""" pass - def create(self, name): + def create(self, name, initial_data=''): """Create a new sub-document in the cabinet with the given name.""" pass def maindoc_name(self): return self._maindoc - @property def library(self): return self._library @@ -73,6 +76,9 @@ class Cabinet(object): def name(self): return self._name + def shelf(self, selector=None): + pass + class Document(object): def __init__(self, cabinet, name): self._cabinet = cabinet @@ -92,7 +98,28 @@ class Document(object): def library(self): return self._cabinet.library + @property + def name(self): + return self._name + + def shelf(self): + return self._cabinet.shelf() + @property + def size(self): + raise NotImplemented() + + @property + def parts(self): + raise NotImplemented() + + +class Shelf(object): + + def __init__(self, cabinet): + self._cabinet = cabinet + + # # Exception classes # @@ -104,6 +131,8 @@ class LibraryException(Exception): self.cause = cause class CabinetNotFound(LibraryException): + def __init__(self, cabname): + LibraryException.__init__(self, "Cabinet '%s' not found." % cabname) pass