Document: by default N/I functions raise IO error.
authorP. Christeas <p_christ@hol.gr>
Wed, 27 Oct 2010 10:23:23 +0000 (13:23 +0300)
committerP. Christeas <p_christ@hol.gr>
Wed, 27 Oct 2010 10:23:23 +0000 (13:23 +0300)
Attempting to create a file or folder at nodes that don't support it,
should be reported as a permission error.

bzr revid: p_christ@hol.gr-20101027102323-3l15biqitaryqelb

addons/document/nodes.py

index 089cde3..d32ccf4 100644 (file)
@@ -366,12 +366,14 @@ class node_class(object):
     def create_child(self, cr, path, data=None):
         """ Create a regular file under this node
         """
-        raise NotImplementedError(repr(self))
+        logger.warning("Attempted to create a file under %r, not possible.", self)
+        raise IOError(errno.EPERM, "Not allowed to create files here")
     
     def create_child_collection(self, cr, objname):
         """ Create a child collection (directory) under self
         """
-        raise NotImplementedError(repr(self))
+        logger.warning("Attempted to create a collection under %r, not possible.", self)
+        raise IOError(errno.EPERM, "Not allowed to create folders here")
 
     def rm(self, cr):
         raise NotImplementedError(repr(self))