diff options
Diffstat (limited to 'addons/document_webdav')
| -rw-r--r-- | addons/document_webdav/dav_fs.py | 40 | ||||
| -rw-r--r-- | addons/document_webdav/document_webdav.py | 2 | ||||
| -rwxr-xr-x | addons/document_webdav/test_davclient.py | 10 | ||||
| -rw-r--r-- | addons/document_webdav/webdav.py | 2 | ||||
| -rw-r--r-- | addons/document_webdav/webdav_server.py | 6 |
5 files changed, 30 insertions, 30 deletions
diff --git a/addons/document_webdav/dav_fs.py b/addons/document_webdav/dav_fs.py index 772b7600f20..13edfd8f77f 100644 --- a/addons/document_webdav/dav_fs.py +++ b/addons/document_webdav/dav_fs.py @@ -98,7 +98,7 @@ class BoundStream2(object): def read(self, size=-1): if not self._stream: - raise IOError(errno.EBADF, "read() without stream") + raise IOError(errno.EBADF, "read() without stream.") if self._rem_length == 0: return '' @@ -136,25 +136,25 @@ class BoundStream2(object): """ if whence == os.SEEK_SET: if pos < 0 or pos > self._length: - raise IOError(errno.EINVAL,"Cannot seek") + raise IOError(errno.EINVAL,"Cannot seek!") self._stream.seek(pos - self._offset) self._rem_length = self._length - pos elif whence == os.SEEK_CUR: if pos > 0: if pos > self._rem_length: - raise IOError(errno.EINVAL,"Cannot seek past end") + raise IOError(errno.EINVAL,"Cannot seek past end!") elif pos < 0: oldpos = self.tell() if oldpos + pos < 0: - raise IOError(errno.EINVAL,"Cannot seek before start") + raise IOError(errno.EINVAL,"Cannot seek before start!") self._stream.seek(pos, os.SEEK_CUR) self._rem_length -= pos elif whence == os.SEEK_END: if pos > 0: - raise IOError(errno.EINVAL,"Cannot seek past end") + raise IOError(errno.EINVAL,"Cannot seek past end!") else: if self._length + pos < 0: - raise IOError(errno.EINVAL,"Cannot seek before start") + raise IOError(errno.EINVAL,"Cannot seek before start!") newpos = self._offset + self._length + pos self._stream.seek(newpos, os.SEEK_SET) self._rem_length = 0 - pos @@ -206,7 +206,7 @@ class openerp_dav_handler(dav_interface): self.parent.log_error("Cannot %s: %s", opname, str(e)) self.parent.log_message("Exc: %s",traceback.format_exc()) # see par 9.3.1 of rfc - raise DAV_Error(403, str(e) or 'Not supported at this path') + raise DAV_Error(403, str(e) or 'Not supported at this path.') except EnvironmentError, err: if cr: cr.close() import traceback @@ -218,7 +218,7 @@ class openerp_dav_handler(dav_interface): if cr: cr.close() self.parent.log_error("Cannot %s: %s", opname, str(e)) self.parent.log_message("Exc: %s",traceback.format_exc()) - raise default_exc("Operation failed") + raise default_exc("Operation failed.") def _get_dav_lockdiscovery(self, uri): """ We raise that so that the node API is used """ @@ -434,7 +434,7 @@ class openerp_dav_handler(dav_interface): except DAV_Error: raise except Exception, e: - self.parent.log_error("cannot get_children: "+ str(e)) + self.parent.log_error("Cannot get_children: "+ str(e)) raise finally: if cr: cr.close() @@ -500,10 +500,10 @@ class openerp_dav_handler(dav_interface): assert start >= 0 if end and end < start: self.parent.log_error("Invalid range for data: %s-%s" %(start, end)) - raise DAV_Error(416, "Invalid range for data") + raise DAV_Error(416, "Invalid range for data.") if end: if end >= res.size(): - raise DAV_Error(416, "Requested data exceeds available size") + raise DAV_Error(416, "Requested data exceeds available size.") length = (end + 1) - start else: length = res.size() - start @@ -661,7 +661,7 @@ class openerp_dav_handler(dav_interface): cr, uid, pool, dbname, uri2 = self.get_cr(uri) if not uri2[-1]: if cr: cr.close() - raise DAV_Error(409, "Cannot create nameless collection") + raise DAV_Error(409, "Cannot create nameless collection.") if not dbname: if cr: cr.close() raise DAV_Error, 409 @@ -672,7 +672,7 @@ class openerp_dav_handler(dav_interface): nc = node.child(cr, uri2[-1]) if nc: cr.close() - raise DAV_Error(405, "Path already exists") + raise DAV_Error(405, "Path already exists.") self._try_function(node.create_child_collection, (cr, uri2[-1]), "create col %s" % uri2[-1], cr=cr) cr.commit() @@ -698,14 +698,14 @@ class openerp_dav_handler(dav_interface): dir_node = self.uri2object(cr, uid, pool, uri2[:-1]) if not dir_node: cr.close() - raise DAV_NotFound('Parent folder not found') + raise DAV_NotFound('Parent folder not found.') newchild = self._try_function(dir_node.create_child, (cr, objname, data), "create %s" % objname, cr=cr) if not newchild: cr.commit() cr.close() - raise DAV_Error(400, "Failed to create resource") + raise DAV_Error(400, "Failed to create resource.") uparts=urlparse.urlparse(uri) fileloc = '/'.join(newchild.full_path()) @@ -937,7 +937,7 @@ class openerp_dav_handler(dav_interface): except AttributeError: # perhaps the node doesn't support locks cr.close() - raise DAV_Error(400, 'No locks for this resource') + raise DAV_Error(400, 'No locks for this resource.') res = self._try_function(node_fn, (cr, token), "unlock %s" % uri, cr=cr) cr.commit() @@ -966,7 +966,7 @@ class openerp_dav_handler(dav_interface): dir_node = self.uri2object(cr, uid, pool, uri2[:-1]) if not dir_node: cr.close() - raise DAV_NotFound('Parent folder not found') + raise DAV_NotFound('Parent folder not found.') # We create a new node (file) but with empty data=None, # as in RFC4918 p. 9.10.4 @@ -975,7 +975,7 @@ class openerp_dav_handler(dav_interface): if not node: cr.commit() cr.close() - raise DAV_Error(400, "Failed to create resource") + raise DAV_Error(400, "Failed to create resource.") created = True @@ -984,7 +984,7 @@ class openerp_dav_handler(dav_interface): except AttributeError: # perhaps the node doesn't support locks cr.close() - raise DAV_Error(400, 'No locks for this resource') + raise DAV_Error(400, 'No locks for this resource.') # Obtain the lock on the node lres, pid, token = self._try_function(node_fn, (cr, lock_data), "lock %s" % objname, cr=cr) @@ -992,7 +992,7 @@ class openerp_dav_handler(dav_interface): if not lres: cr.commit() cr.close() - raise DAV_Error(423, "Resource already locked") + raise DAV_Error(423, "Resource already locked.") assert isinstance(lres, list), 'lres: %s' % repr(lres) diff --git a/addons/document_webdav/document_webdav.py b/addons/document_webdav/document_webdav.py index da463c9eb1b..4388c92b004 100644 --- a/addons/document_webdav/document_webdav.py +++ b/addons/document_webdav/document_webdav.py @@ -43,7 +43,7 @@ class document_davdir(osv.osv): elif dbro.type == 'ressource': return nodes.node_res_dir else: - raise ValueError("dir node for %s type", dbro.type) + raise ValueError("Directory node for %s type", dbro.type) def _prepare_context(self, cr, uid, nctx, context=None): nctx.node_file_class = nodes.node_file diff --git a/addons/document_webdav/test_davclient.py b/addons/document_webdav/test_davclient.py index a4dda231bd8..a0b498f61d0 100755 --- a/addons/document_webdav/test_davclient.py +++ b/addons/document_webdav/test_davclient.py @@ -278,7 +278,7 @@ class addAuthTransport: return self._parse_response(h.getfile(), sock, resp) - raise ProtocolError(host+handler, 403, "No authentication",'') + raise ProtocolError(host+handler, 403, "No authentication.",'') class PersistentAuthTransport(addAuthTransport,PersistentTransport): pass @@ -402,7 +402,7 @@ class DAVClient(object): r1 = conn.getresponse() except httplib.BadStatusLine, bsl: log.warning("Bad status line: %s", bsl.line) - raise Exception('Bad status line') + raise Exception('Bad status line.') if r1.status == 401: # and r1.headers: if 'www-authenticate' in r1.msg: (atype,realm) = r1.msg.getheader('www-authenticate').split(' ',1) @@ -437,7 +437,7 @@ class DAVClient(object): doc = xml.dom.minidom.parseString(data1) _logger.debug("XML Body:\n %s", doc.toprettyxml(indent="\t")) except Exception: - _logger.warning("could not print xml", exc_info=True) + _logger.warning("cannot print xml", exc_info=True) pass conn.close() return r1.status, r1.msg, data1 @@ -651,7 +651,7 @@ class DAVClient(object): if isinstance(crange, tuple): crange = [crange,] if not isinstance(crange, list): - raise TypeError("Range must be a tuple or list of tuples") + raise TypeError("Range must be a tuple or list of tuples.") rs = [] for r in crange: rs.append('%d-%d' % r) @@ -689,7 +689,7 @@ class DAVClient(object): """ hdrs = { } if not (body or srcpath): - raise ValueError("PUT must have something to send") + raise ValueError("PUT must have something to send.") if (not body) and srcpath: fd = open(srcpath, 'rb') body = fd.read() diff --git a/addons/document_webdav/webdav.py b/addons/document_webdav/webdav.py index baa394e94a1..903dd6a16ba 100644 --- a/addons/document_webdav/webdav.py +++ b/addons/document_webdav/webdav.py @@ -65,7 +65,7 @@ class Prop2xml(object): def createText2Node(self, data): if not isinstance(data, StringTypes): - raise TypeError, "node contents must be a string" + raise TypeError, "Node contents must be a string." t = Text2() t.data = data t.ownerDocument = self.doc diff --git a/addons/document_webdav/webdav_server.py b/addons/document_webdav/webdav_server.py index 65ebb49ff5f..427a6f57d53 100644 --- a/addons/document_webdav/webdav_server.py +++ b/addons/document_webdav/webdav_server.py @@ -119,7 +119,7 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): if up.path.startswith(self.davpath): self.headers['Destination'] = up.path[len(self.davpath):] else: - raise DAV_Forbidden("Not allowed to copy/move outside webdav path") + raise DAV_Forbidden("Not allowed to copy/move outside webdav path.") # TODO: locks DAVRequestHandler.copymove(self, CLASS) @@ -338,7 +338,7 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): if isinstance(ldif, list): if len(ldif) !=1 or (not isinstance(ldif[0], TagList)) \ or len(ldif[0].list) != 1: - raise DAV_Error(400, "Cannot accept multiple tokens") + raise DAV_Error(400, "Cannot accept multiple tokens!") ldif = ldif[0].list[0] if ldif[0] == '<' and ldif[-1] == '>': ldif = ldif[1:-1] @@ -352,7 +352,7 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): lock_data.update(self._lock_unlock_parse(body)) if lock_data['refresh'] and not lock_data.get('token', False): - raise DAV_Error(400, 'Lock refresh must specify token') + raise DAV_Error(400, 'Lock refresh must specify token!') lock_data['depth'] = depth |
