fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Poprawienienie implementacji obserwatorów.
[redakcja.git]
/
lib
/
wlrepo
/
__init__.py
diff --git
a/lib/wlrepo/__init__.py
b/lib/wlrepo/__init__.py
index
5c27dc9
..
210322d
100644
(file)
--- a/
lib/wlrepo/__init__.py
+++ b/
lib/wlrepo/__init__.py
@@
-38,12
+38,24
@@
class Cabinet(object):
if name:
self._name = name
self._maindoc = ''
if name:
self._name = name
self._maindoc = ''
+ self._user = self._document = None
elif doc and user:
elif doc and user:
+ self._user = user
+ self._document = doc
self._name = user + ':' + doc
self._maindoc = doc
else:
raise ValueError("You must provide either name or doc and user.")
self._name = user + ':' + doc
self._maindoc = doc
else:
raise ValueError("You must provide either name or doc and user.")
+ print "new cab:", self._name, self._user, self._document
+
+ @property
+ def username(self):
+ return self._user
+
+ def __str__(self):
+ return "Cabinet(%s)" % self._name
+
def documents(self):
"""Lists all documents and sub-documents in this cabinet."""
pass
def documents(self):
"""Lists all documents and sub-documents in this cabinet."""
pass
@@
-57,14
+69,14
@@
class Cabinet(object):
as the name for the main document"""
pass
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
"""Create a new sub-document in the cabinet with the given name."""
pass
-
+
+ @property
def maindoc_name(self):
return self._maindoc
def maindoc_name(self):
return self._maindoc
-
@property
def library(self):
return self._library
@property
def library(self):
return self._library
@@
-73,6
+85,9
@@
class Cabinet(object):
def name(self):
return self._name
def name(self):
return self._name
+ def shelf(self, selector=None):
+ pass
+
class Document(object):
def __init__(self, cabinet, name):
self._cabinet = cabinet
class Document(object):
def __init__(self, cabinet, name):
self._cabinet = cabinet
@@
-92,7
+107,27
@@
class Document(object):
def library(self):
return self._cabinet.library
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, lib):
+ self._library = lib
+
#
# Exception classes
#
#
# Exception classes
#
@@
-104,6
+139,8
@@
class LibraryException(Exception):
self.cause = cause
class CabinetNotFound(LibraryException):
self.cause = cause
class CabinetNotFound(LibraryException):
+ def __init__(self, cabname):
+ LibraryException.__init__(self, "Cabinet '%s' not found." % cabname)
pass
pass