[IMP]Document (ftp,webdev) : Warning Messages are changed
bzr revid: hsa@tinyerp.com-20120713052957-iie8hdqbde1g3qz9
This commit is contained in:
parent
a710d7b11c
commit
770dc652af
|
@ -176,7 +176,7 @@ class abstracted_fs(object):
|
|||
res = node.open_data(cr, mode)
|
||||
cr.commit()
|
||||
except TypeError:
|
||||
raise IOError(errno.EINVAL, "No data")
|
||||
raise IOError(errno.EINVAL, "No data.")
|
||||
return res
|
||||
|
||||
# ok, but need test more
|
||||
|
@ -211,9 +211,9 @@ class abstracted_fs(object):
|
|||
self.cwd_node = None
|
||||
return None
|
||||
if not datacr[1]:
|
||||
raise OSError(1, 'Operation not permitted')
|
||||
raise OSError(1, 'Operation not permitted.')
|
||||
if datacr[1].type not in ('collection','database'):
|
||||
raise OSError(2, 'Path is not a directory')
|
||||
raise OSError(2, 'Path is not a directory.')
|
||||
self.cwd = '/'+datacr[1].context.dbname + '/'
|
||||
self.cwd += '/'.join(datacr[1].full_path())
|
||||
self.cwd_node = datacr[1]
|
||||
|
@ -287,7 +287,7 @@ class abstracted_fs(object):
|
|||
p_parts = p_parts[1:]
|
||||
# self._log.debug("Path parts: %r ", p_parts)
|
||||
if not p_parts:
|
||||
raise IOError(errno.EPERM, 'Cannot perform operation at root dir')
|
||||
raise IOError(errno.EPERM, 'Cannot perform operation at root directory.')
|
||||
dbname = p_parts[0]
|
||||
if dbname not in self.db_list():
|
||||
raise IOError(errno.ENOENT,'Invalid database path: %s' % dbname)
|
||||
|
@ -318,7 +318,7 @@ class abstracted_fs(object):
|
|||
node = self.cwd_node
|
||||
if node is False and mode not in ('???'):
|
||||
cr.close()
|
||||
raise IOError(errno.ENOENT, 'Path does not exist')
|
||||
raise IOError(errno.ENOENT, 'Path does not exist!')
|
||||
return (cr, node, rem_path)
|
||||
|
||||
def get_node_cr_uid(self, node):
|
||||
|
@ -429,7 +429,7 @@ class abstracted_fs(object):
|
|||
def getsize(self, datacr):
|
||||
"""Return the size of the specified file in bytes."""
|
||||
if not (datacr and datacr[1]):
|
||||
raise IOError(errno.ENOENT, "No such file or directory")
|
||||
raise IOError(errno.ENOENT, "No such file or directory.")
|
||||
if datacr[1].type in ('file', 'content'):
|
||||
return datacr[1].get_data_len(datacr[0]) or 0L
|
||||
return 0L
|
||||
|
|
|
@ -308,7 +308,7 @@ class DummyAuthorizer:
|
|||
raise AuthorizerError('No such directory: "%s"' %homedir)
|
||||
for p in perm:
|
||||
if p not in 'elradfmw':
|
||||
raise AuthorizerError('No such permission "%s"' %p)
|
||||
raise AuthorizerError('No such permission: "%s"' %p)
|
||||
for p in perm:
|
||||
if (p in self.write_perms) and (username == 'anonymous'):
|
||||
warnings.warn("write permissions assigned to anonymous user.",
|
||||
|
@ -638,7 +638,7 @@ class DTPHandler(asyncore.dispatcher):
|
|||
elif type == 'i':
|
||||
self.data_wrapper = lambda x: x
|
||||
else:
|
||||
raise TypeError, "Unsupported type"
|
||||
raise TypeError, "Unsupported type!"
|
||||
self.receive = True
|
||||
|
||||
def get_transmitted_bytes(self):
|
||||
|
@ -823,7 +823,7 @@ class FileProducer:
|
|||
elif type == 'i':
|
||||
self.data_wrapper = lambda x: x
|
||||
else:
|
||||
raise TypeError, "Unsupported type"
|
||||
raise TypeError, "Unsupported type!"
|
||||
|
||||
def more(self):
|
||||
"""Attempt a chunk of data of size self.buffer_size."""
|
||||
|
@ -2554,7 +2554,7 @@ class FTPHandler(asynchat.async_chat):
|
|||
else:
|
||||
datacr = self.get_crdata2(line)
|
||||
if not datacr:
|
||||
raise IOError(errno.ENOENT, "%s is not retrievable" %line)
|
||||
raise IOError(errno.ENOENT, "%s is not retrievable." %line)
|
||||
|
||||
lmt = self.try_as_current_user(self.fs.getmtime, (datacr,), line=line)
|
||||
lmt = time.strftime("%Y%m%d%H%M%S", time.localtime(lmt))
|
||||
|
|
|
@ -62,7 +62,7 @@ def get_ftp_fulldata(ftp, fname, limit=8192):
|
|||
data = []
|
||||
def ffp(data, ndata):
|
||||
if len(data)+ len(ndata) > limit:
|
||||
raise IndexError('Data over the limit')
|
||||
raise IndexError('Data over the limit.')
|
||||
data.append(ndata)
|
||||
ftp.retrbinary('RETR %s' % fname, partial(ffp,data))
|
||||
return ''.join(data)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue