summaryrefslogtreecommitdiff
path: root/addons/document
diff options
context:
space:
mode:
authorAntonin Bourguignon <abo@openerp.com>2012-08-06 19:08:41 +0200
committerAntonin Bourguignon <abo@openerp.com>2012-08-06 19:08:41 +0200
commita52eeef5194b5fdab2b1d659f383c7589a2ebb98 (patch)
treeb494ed4d9c36efccba46a2814bea097af47b57f7 /addons/document
parentd928b07ace2b1f9b8a50ef11075cbea0fa9a6060 (diff)
[IMP] rephrase some error and warning messages in document, edi, google_base_account, mrp and mrp_repair
remove exclamation marks at the end of messages remove unjustified capital letters bzr revid: abo@openerp.com-20120806170841-cx9vuend1vglmsqk
Diffstat (limited to 'addons/document')
-rw-r--r--addons/document/content_index.py8
-rw-r--r--addons/document/document.py10
-rw-r--r--addons/document/document_directory.py14
-rw-r--r--addons/document/document_storage.py102
-rw-r--r--addons/document/nodes.py70
5 files changed, 102 insertions, 102 deletions
diff --git a/addons/document/content_index.py b/addons/document/content_index.py
index 61b418e097c..4cf3c8dfed2 100644
--- a/addons/document/content_index.py
+++ b/addons/document/content_index.py
@@ -93,13 +93,13 @@ class indexer(object):
except NhException:
pass
- raise NhException('No appropriate method to index file !')
+ raise NhException('No appropriate method to index file.')
def _doIndexContent(self,content):
- raise NhException("Content cannot be handled here!")
+ raise NhException("Content cannot be handled here.")
def _doIndexFile(self,fpath):
- raise NhException("Content cannot be handled here!")
+ raise NhException("Content cannot be handled here.")
def __repr__(self):
return "<indexer %s.%s>" %(self.__module__, self.__class__.__name__)
@@ -116,7 +116,7 @@ def mime_match(mime, mdict):
return (None, None)
class contentIndex(object):
-
+
def __init__(self):
self.mimes = {}
self.exts = {}
diff --git a/addons/document/document.py b/addons/document/document.py
index 27abb92c80c..3ee52f8e4fb 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -23,7 +23,7 @@ import base64
from osv import osv, fields
import os
-# from psycopg2 import Binary
+#from psycopg2 import Binary
#from tools import config
import tools
from tools.translate import _
@@ -37,8 +37,8 @@ DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config['roo
class document_file(osv.osv):
_inherit = 'ir.attachment'
_rec_name = 'datas_fname'
-
-
+
+
def _attach_parent_id(self, cr, uid, ids=None, context=None):
"""Migrate ir.attachments to the document module.
@@ -61,7 +61,7 @@ class document_file(osv.osv):
return False
if ids is not None:
- raise NotImplementedError("Ids is just there by convention,please do not use it.")
+ raise NotImplementedError("Ids are just there by convention, please do not use it.")
cr.execute("UPDATE ir_attachment " \
"SET parent_id = %s, db_datas = decode(encode(db_datas,'escape'), 'base64') " \
@@ -294,7 +294,7 @@ class document_file(osv.osv):
('datas_fname', '=', vals['datas_fname']),
]
attach_ids = self.search(cr, uid, domain, context=context)
- super(document_file, self).write(cr, uid, attach_ids,
+ super(document_file, self).write(cr, uid, attach_ids,
{'datas' : vals['datas']},
context=context)
result = attach_ids[0]
diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py
index 4afb5a0b121..0f18673a007 100644
--- a/addons/document/document_directory.py
+++ b/addons/document/document_directory.py
@@ -78,7 +78,7 @@ class document_directory(osv.osv):
root_id = objid.read(cr, uid, mid, ['res_id'])['res_id']
return root_id
except Exception, e:
-
+
_logger.warning('Cannot set directory root:'+ str(e))
return False
return objid.browse(cr, uid, mid, context=context).res_id
@@ -153,7 +153,7 @@ class document_directory(osv.osv):
return True
_constraints = [
- (_check_recursion, 'Error! You cannot create recursive Directories.', ['parent_id'])
+ (_check_recursion, 'Error! You cannot create recursive directories.', ['parent_id'])
]
def __init__(self, *args, **kwargs):
@@ -179,7 +179,7 @@ class document_directory(osv.osv):
def get_node_class(self, cr, uid, ids, dbro=None, dynamic=False, context=None):
"""Retrieve the class of nodes for this directory
-
+
This function can be overriden by inherited classes ;)
@param dbro The browse object, if caller already has it
"""
@@ -193,17 +193,17 @@ class document_directory(osv.osv):
elif dbro.type == 'ressource':
return nodes.node_res_dir
else:
- raise ValueError("dir node for %s type!", dbro.type)
+ raise ValueError("dir node for %s type.", dbro.type)
def _prepare_context(self, cr, uid, nctx, context=None):
""" Fill nctx with properties for this database
@param nctx instance of nodes.node_context, to be filled
@param context ORM context (dict) for us
-
- Note that this function is called *without* a list of ids,
+
+ Note that this function is called *without* a list of ids,
it should behave the same for the whole database (based on the
ORM instance of document.directory).
-
+
Some databases may override this and attach properties to the
node_context. See WebDAV, CalDAV.
"""
diff --git a/addons/document/document_storage.py b/addons/document/document_storage.py
index aa9ad8ddfa1..21cb4f9dcf4 100644
--- a/addons/document/document_storage.py
+++ b/addons/document/document_storage.py
@@ -52,7 +52,7 @@ For data /storage/ we have the cases:
Have (ir.attachment, context), we modify the file (save, update, rename etc).
Have (directory, context), we create a file.
Have (path, context), we create or modify a file.
-
+
Note that in all above cases, we don't explicitly choose the storage media,
but always require a context to be present.
@@ -61,7 +61,7 @@ nodes, for once, won't. Their metadata will be computed by the parent storage
media + directory.
The algorithm says that in any of the above cases, our first goal is to locate
-the node for any combination of search criteria. It would be wise NOT to
+the node for any combination of search criteria. It would be wise NOT to
represent each node in the path (like node[/] + node[/dir1] + node[/dir1/dir2])
but directly jump to the end node (like node[/dir1/dir2]) whenever possible.
@@ -99,13 +99,13 @@ class nodefd_file(nodes.node_descriptor):
mode = mode[:-1]
self.mode = mode
self._size = os.stat(path).st_size
-
+
for attr in ('closed', 'read', 'write', 'seek', 'tell', 'next'):
setattr(self,attr, getattr(self.__file, attr))
def size(self):
return self._size
-
+
def __iter__(self):
return self
@@ -122,7 +122,7 @@ class nodefd_file(nodes.node_descriptor):
filename = par.path
if isinstance(filename, (tuple, list)):
filename = '/'.join(filename)
-
+
try:
mime, icont = cntIndex.doIndex(None, filename=filename,
content_type=None, realfname=fname)
@@ -173,7 +173,7 @@ class nodefd_db(StringIO, nodes.node_descriptor):
self._size = 0L
if mode.endswith('b'):
mode = mode[:-1]
-
+
if mode in ('r', 'r+'):
cr = ira_browse._cr # reuse the cursor of the browse object, just now
cr.execute('SELECT db_datas FROM ir_attachment WHERE id = %s',(ira_browse.id,))
@@ -189,7 +189,7 @@ class nodefd_db(StringIO, nodes.node_descriptor):
StringIO.__init__(self, None)
else:
_logger.error("Incorrect mode %s is specified.", mode)
- raise IOError(errno.EINVAL, "Invalid file mode!")
+ raise IOError(errno.EINVAL, "Invalid file mode.")
self.mode = mode
def size(self):
@@ -209,7 +209,7 @@ class nodefd_db(StringIO, nodes.node_descriptor):
filename = par.path
if isinstance(filename, (tuple, list)):
filename = '/'.join(filename)
-
+
try:
mime, icont = cntIndex.doIndex(data, filename=filename,
content_type=None, realfname=None)
@@ -246,7 +246,7 @@ class nodefd_db(StringIO, nodes.node_descriptor):
class nodefd_db64(StringIO, nodes.node_descriptor):
""" A descriptor to db data, base64 (the old way)
-
+
It stores the data in base64 encoding at the db. Not optimal, but
the transparent compression of Postgres will save the day.
"""
@@ -255,7 +255,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor):
self._size = 0L
if mode.endswith('b'):
mode = mode[:-1]
-
+
if mode in ('r', 'r+'):
data = base64.decodestring(ira_browse.db_datas)
if data:
@@ -269,7 +269,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor):
StringIO.__init__(self, None)
else:
_logger.error("Incorrect mode %s is specified.", mode)
- raise IOError(errno.EINVAL, "Invalid file mode!")
+ raise IOError(errno.EINVAL, "Invalid file mode.")
self.mode = mode
def size(self):
@@ -289,7 +289,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor):
filename = par.path
if isinstance(filename, (tuple, list)):
filename = '/'.join(filename)
-
+
try:
mime, icont = cntIndex.doIndex(data, filename=filename,
content_type=None, realfname=None)
@@ -317,7 +317,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor):
(base64.encodestring(data), len(data), par.file_id))
cr.commit()
except Exception:
- _logger.exception('Cannot update db file #%d for close !', par.file_id)
+ _logger.exception('Cannot update db file #%d for close.', par.file_id)
raise
finally:
cr.close()
@@ -330,7 +330,7 @@ class document_storage(osv.osv):
media.
The referring document.directory-ies will control the placement of data
into the storage.
-
+
It is a bad idea to have multiple document.storage objects pointing to
the same tree of filesystem storage.
"""
@@ -384,12 +384,12 @@ class document_storage(osv.osv):
def __prepare_realpath(self, cr, file_node, ira, store_path, do_create=True):
""" Cleanup path for realstore, create dirs if needed
-
+
@param file_node the node
@param ira ir.attachment browse of the file_node
@param store_path the path of the parent storage object, list
@param do_create create the directories, if needed
-
+
@return tuple(path "/var/filestore/real/dir/", npath ['dir','fname.ext'] )
"""
file_node.fix_ppath(cr, ira)
@@ -401,10 +401,10 @@ class document_storage(osv.osv):
# self._logger.debug('Npath: %s', npath)
for n in npath:
if n == '..':
- raise ValueError("Invalid '..' element in path!")
+ raise ValueError("Invalid '..' element in path.")
for ch in ('*', '|', "\\", '/', ':', '"', '<', '>', '?',):
if ch in n:
- raise ValueError("Invalid char %s in path %s!" %(ch, n))
+ raise ValueError("Invalid char %s in path %s." %(ch, n))
dpath = [store_path,]
dpath += npath[:-1]
path = os.path.join(*dpath)
@@ -420,8 +420,8 @@ class document_storage(osv.osv):
"""
boo = self.browse(cr, uid, id, context=context)
if not boo.online:
- raise IOError(errno.EREMOTE, 'Medium offline!')
-
+ raise IOError(errno.EREMOTE, 'Medium offline.')
+
if fil_obj:
ira = fil_obj
else:
@@ -435,11 +435,11 @@ class document_storage(osv.osv):
context = {}
boo = self.browse(cr, uid, id, context=context)
if not boo.online:
- raise IOError(errno.EREMOTE, 'medium offline!')
-
+ raise IOError(errno.EREMOTE, 'Medium offline.')
+
if boo.readonly and mode not in ('r', 'rb'):
- raise IOError(errno.EPERM, "Readonly medium!")
-
+ raise IOError(errno.EPERM, "Readonly medium.")
+
ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context)
if boo.type == 'filestore':
if not ira.store_fname:
@@ -447,8 +447,8 @@ class document_storage(osv.osv):
# try to fix their directory.
if mode in ('r','r+'):
if ira.file_size:
- _logger.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id)
- raise IOError(errno.ENOENT, 'No file can be located!')
+ _logger.warning( "ir.attachment #%d does not have a filename, but is at filestore. This should get fixed." % ira.id)
+ raise IOError(errno.ENOENT, 'No file can be located.')
else:
store_fname = self.__get_random_fname(boo.path)
cr.execute('UPDATE ir_attachment SET store_fname = %s WHERE id = %s',
@@ -479,9 +479,9 @@ class document_storage(osv.osv):
elif boo.type == 'virtual':
raise ValueError('Virtual storage does not support static file(s).')
-
+
else:
- raise TypeError("No %s storage !" % boo.type)
+ raise TypeError("No %s storage." % boo.type)
def __get_data_3(self, cr, uid, boo, ira, context):
if boo.type == 'filestore':
@@ -489,7 +489,7 @@ class document_storage(osv.osv):
# On a migrated db, some files may have the wrong storage type
# try to fix their directory.
if ira.file_size:
- _logger.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id)
+ _logger.warning( "ir.attachment #%d does not have a filename, but is at filestore. This should get fixed." % ira.id)
return None
fpath = os.path.join(boo.path, ira.store_fname)
return file(fpath, 'rb').read()
@@ -541,10 +541,10 @@ class document_storage(osv.osv):
ira = self.pool.get('ir.attachment').browse(cr, uid, file_node.file_id, context=context)
if not boo.online:
- raise IOError(errno.EREMOTE, 'Medium offline!')
-
+ raise IOError(errno.EREMOTE, 'Medium offline.')
+
if boo.readonly:
- raise IOError(errno.EPERM, "Readonly medium!")
+ raise IOError(errno.EPERM, "Readonly medium.")
_logger.debug( "Store data for ir.attachment #%d." % ira.id)
store_fname = None
@@ -557,11 +557,11 @@ class document_storage(osv.osv):
fp = open(fname, 'wb')
try:
fp.write(data)
- finally:
+ finally:
fp.close()
_logger.debug( "Saved data to %s." % fname)
filesize = len(data) # os.stat(fname).st_size
-
+
# TODO Here, an old file would be left hanging.
except Exception, e:
@@ -586,7 +586,7 @@ class document_storage(osv.osv):
fp = open(fname,'wb')
try:
fp.write(data)
- finally:
+ finally:
fp.close()
_logger.debug("Saved data to %s.", fname)
filesize = len(data) # os.stat(fname).st_size
@@ -639,10 +639,10 @@ class document_storage(osv.osv):
files that have to be removed, too. """
if not storage_bo.online:
- raise IOError(errno.EREMOTE, 'Medium offline!')
-
+ raise IOError(errno.EREMOTE, 'Medium offline.')
+
if storage_bo.readonly:
- raise IOError(errno.EPERM, "Readonly medium!")
+ raise IOError(errno.EPERM, "Readonly medium.")
if storage_bo.type == 'filestore':
fname = fil_bo.store_fname
@@ -677,17 +677,17 @@ class document_storage(osv.osv):
""" A preparation for a file rename.
It will not affect the database, but merely check and perhaps
rename the realstore file.
-
+
@return the dict of values that can safely be be stored in the db.
"""
sbro = self.browse(cr, uid, file_node.storage_id, context=context)
assert sbro, "The file #%d didn't provide storage" % file_node.file_id
if not sbro.online:
- raise IOError(errno.EREMOTE, 'Medium offline!')
-
+ raise IOError(errno.EREMOTE, 'Medium offline.')
+
if sbro.readonly:
- raise IOError(errno.EPERM, "Readonly medium!")
+ raise IOError(errno.EPERM, "Readonly medium.")
if sbro.type in ('filestore', 'db', 'db64'):
# nothing to do for a rename, allow to change the db field
@@ -717,7 +717,7 @@ class document_storage(osv.osv):
""" A preparation for a file move.
It will not affect the database, but merely check and perhaps
move the realstore file.
-
+
@param ndir_bro a browse object of document.directory, where this
file should move to.
@return the dict of values that can safely be be stored in the db.
@@ -726,10 +726,10 @@ class document_storage(osv.osv):
assert sbro, "The file #%d didn't provide storage" % file_node.file_id
if not sbro.online:
- raise IOError(errno.EREMOTE, 'Medium offline!')
-
+ raise IOError(errno.EREMOTE, 'Medium offline.')
+
if sbro.readonly:
- raise IOError(errno.EPERM, "Readonly medium!")
+ raise IOError(errno.EPERM, "Readonly medium.")
par = ndir_bro
psto = None
@@ -757,7 +757,7 @@ class document_storage(osv.osv):
_logger.warning("Inconsistency to realstore: %s != %s." , fname, repr(opath))
oldpath = os.path.join(path, opath[-1])
-
+
npath = [sbro.path,] + (ndir_bro.get_full_path() or [])
npath = filter(lambda x: x is not None, npath)
newdir = os.path.join(*npath)
@@ -766,16 +766,16 @@ class document_storage(osv.osv):
os.makedirs(newdir)
npath.append(opath[-1])
newpath = os.path.join(*npath)
-
+
_logger.debug("Going to move %s from %s to %s.", opath[-1], oldpath, newpath)
shutil.move(oldpath, newpath)
-
+
store_path = npath[1:] + [opath[-1],]
store_fname = os.path.join(*store_path)
-
+
return { 'store_fname': store_fname }
else:
- raise TypeError("No %s storage!" % sbro.type)
+ raise TypeError("No %s storage." % sbro.type)
document_storage()
diff --git a/addons/document/nodes.py b/addons/document/nodes.py
index ea18f630314..f1c3c71a8e6 100644
--- a/addons/document/nodes.py
+++ b/addons/document/nodes.py
@@ -45,7 +45,7 @@ _logger = logging.getLogger(__name__)
def _str2time(cre):
""" Convert a string with time representation (from db) into time (float)
-
+
Note: a place to fix if datetime is used in db.
"""
if not cre:
@@ -62,7 +62,7 @@ def get_node_context(cr, uid, context):
class node_context(object):
""" This is the root node, representing access to some particular context
-
+
A context is a set of persistent data, which may influence the structure
of the nodes. All other transient information during a data query should
be passed down with function arguments.
@@ -99,7 +99,7 @@ class node_context(object):
def __ne__(self, other):
return not self.__eq__(other)
-
+
def get(self, name, default=None):
return self.context.get(name, default)
@@ -119,7 +119,7 @@ class node_context(object):
"""Create (or locate) a node for a directory
@param dbro a browse object of document.directory
"""
-
+
fullpath = dbro.get_full_path(context=self.context)
klass = dbro.get_node_class(dbro, context=self.context)
return klass(fullpath, None ,self, dbro)
@@ -183,7 +183,7 @@ class node_descriptor(object):
def __nonzero__(self):
""" Ensure that a node_descriptor will never equal False
-
+
Since we do define __len__ and __iter__ for us, we must avoid
being regarded as non-true objects.
"""
@@ -244,7 +244,7 @@ class node_class(object):
else:
s.append(self.path)
return s #map(lambda x: '/' +x, s)
-
+
def __repr__(self):
return "%s@/%s" % (self.our_type, '/'.join(self.full_path()))
@@ -323,7 +323,7 @@ class node_class(object):
def get_dav_eprop(self, cr, ns, prop):
if not self.DAV_M_NS:
return None
-
+
if self.DAV_M_NS.has_key(ns):
prefix = self.DAV_M_NS[ns]
else:
@@ -340,12 +340,12 @@ class node_class(object):
r = m(cr)
return r
except AttributeError:
- _logger.debug('Property %s not supported.' % prop, exc_info=True)
+ _logger.debug('The property %s is not supported.' % prop, exc_info=True)
return None
def get_dav_resourcetype(self, cr):
""" Get the DAV resource type.
-
+
Is here because some nodes may exhibit special behaviour, like
CalDAV/GroupDAV collections
"""
@@ -385,7 +385,7 @@ class node_class(object):
"""
_logger.warning("Attempted to create a file under %r, not possible.", self)
raise IOError(errno.EPERM, "Not allowed to create file(s) here.")
-
+
def create_child_collection(self, cr, objname):
""" Create a child collection (directory) under self
"""
@@ -404,7 +404,7 @@ class node_class(object):
def check_perms(self, perms):
""" Check the permissions of the current node.
-
+
@param perms either an integers of the bits to check, or
a string with the permission letters
@@ -414,7 +414,7 @@ class node_class(object):
4, r : allow read of file, or listing of dir contents
8, u : allow remove (unlink)
"""
-
+
if isinstance(perms, str):
pe2 = 0
chars = { 'x': 1, 'w': 2, 'r': 4, 'u': 8 }
@@ -426,7 +426,7 @@ class node_class(object):
raise ValueError("Invalid permission bits.")
else:
raise ValueError("Invalid permission attribute.")
-
+
return ((self.uidperms & perms) == perms)
class node_database(node_class):
@@ -463,7 +463,7 @@ class node_database(node_class):
is_allowed = self.check_perms(1)
else:
is_allowed = self.check_perms(5)
-
+
if not is_allowed:
raise IOError(errno.EPERM, "Permission into directory denied.")
@@ -493,7 +493,7 @@ def mkdosname(company_name, default='noname'):
for c in company_name[:8]:
n += (c in badchars and '_') or c
return n
-
+
def _uid2unixperms(perms, has_owner):
""" Convert the uidperms and the owner flag to full unix bits
@@ -566,7 +566,7 @@ class node_dir(node_database):
def _file_get(self, cr, nodename=False):
res = super(node_dir,self)._file_get(cr, nodename)
-
+
is_allowed = self.check_perms(nodename and 1 or 5)
if not is_allowed:
raise IOError(errno.EPERM, "Permission into directory denied.")
@@ -583,7 +583,7 @@ class node_dir(node_database):
res.extend(res3)
return res
-
+
def _child_get(self, cr, name=None, domain=None):
dirobj = self.context._dirobj
uid = self.context.uid
@@ -595,7 +595,7 @@ class node_dir(node_database):
is_allowed = self.check_perms(1)
else:
is_allowed = self.check_perms(5)
-
+
if not is_allowed:
raise IOError(errno.EPERM, "Permission into directory denied.")
@@ -640,7 +640,7 @@ class node_dir(node_database):
raise OSError(39, 'Directory not empty.')
res = self.context._dirobj.unlink(cr, uid, [directory.id])
else:
- raise OSError(1, 'Operation is not permited.')
+ raise OSError(1, 'Operation is not permitted.')
return res
def create_child_collection(self, cr, objname):
@@ -654,7 +654,7 @@ class node_dir(node_database):
ctx.update(self.dctx)
obj = dirobj.browse(cr, uid, self.dir_id)
if obj and (obj.type == 'ressource') and not object2:
- raise OSError(1, 'Operation is not permited.')
+ raise OSError(1, 'Operation is not permitted.')
#objname = uri2[-1]
val = {
@@ -730,7 +730,7 @@ class node_dir(node_database):
ret = {}
if new_name and (new_name != dbro.name):
if ndir_node.child(cr, new_name):
- raise IOError(errno.EEXIST, "Destination path already exists!")
+ raise IOError(errno.EEXIST, "Destination path already exists.")
ret['name'] = new_name
del dbro
@@ -864,10 +864,10 @@ class node_res_dir(node_class):
if not res_name:
continue
# Yes! we can't do better but skip nameless records.
-
+
# Escape the name for characters not supported in filenames
res_name = res_name.replace('/','_') # any other weird char?
-
+
if name and (res_name != ustr(name)):
# we have matched _ to any character, but we only meant to match
# the special ones.
@@ -1057,7 +1057,7 @@ class node_res_obj(node_class):
where2 = where + [('parent_id','=',self.dir_id) ]
ids = dirobj.search(cr, uid, where2, context=ctx)
bo = obj.browse(cr, uid, self.res_id, context=ctx)
-
+
for dirr in dirobj.browse(cr, uid, ids, context=ctx):
if name and (name != dirr.name):
continue
@@ -1114,7 +1114,7 @@ class node_res_obj(node_class):
obj = dirobj.browse(cr, uid, self.dir_id)
if obj and (obj.type == 'ressource') and not object2:
- raise OSError(1, 'Operation is not permited.')
+ raise OSError(1, 'Operation is not permitted.')
val = {
@@ -1177,14 +1177,14 @@ class node_file(node_class):
self.write_date = fil.write_date or fil.create_date
self.content_length = fil.file_size
self.displayname = fil.name
-
+
self.uidperms = 14
if parent:
if not parent.check_perms('x'):
self.uidperms = 0
elif not parent.check_perms('w'):
self.uidperms = 4
-
+
try:
self.uuser = (fil.user_id and fil.user_id.login) or 'nobody'
except Exception:
@@ -1323,7 +1323,7 @@ class node_file(node_class):
# there *must* be a parent node for this one
self.parent = self.context.get_dir_node(cr, dbro.parent_id)
assert self.parent
-
+
ret = {}
if ndir_node and self.parent != ndir_node:
if not (isinstance(self.parent, node_dir) and isinstance(ndir_node, node_dir)):
@@ -1373,7 +1373,7 @@ class node_content(node_class):
self.uidperms = parent.uidperms & 14
self.uuser = parent.uuser
self.ugroup = parent.ugroup
-
+
self.extension = cnt.extension
self.report_id = cnt.report_id and cnt.report_id.id
#self.mimetype = cnt.extension.
@@ -1417,13 +1417,13 @@ class node_content(node_class):
cperms = 'rw'
else:
raise IOError(errno.EINVAL, "Cannot open at mode %s." % mode)
-
+
if not self.check_perms(cperms):
raise IOError(errno.EPERM, "Permission denied.")
ctx = self.context.context.copy()
ctx.update(self.dctx)
-
+
return nodefd_content(self, cr, mode, ctx)
def get_data_len(self, cr, fil_obj = None):
@@ -1451,7 +1451,7 @@ class node_content(node_class):
return ''
class nodefd_content(StringIO, node_descriptor):
-
+
""" A descriptor to content nodes
"""
def __init__(self, parent, cr, mode, ctx):
@@ -1474,7 +1474,7 @@ class nodefd_content(StringIO, node_descriptor):
StringIO.__init__(self, None)
else:
_logger.error("Incorrect mode %s is specified.", mode)
- raise IOError(errno.EINVAL, "Invalid file mode!")
+ raise IOError(errno.EINVAL, "Invalid file mode.")
self.mode = mode
def size(self):
@@ -1506,7 +1506,7 @@ class nodefd_content(StringIO, node_descriptor):
StringIO.close(self)
class nodefd_static(StringIO, node_descriptor):
-
+
""" A descriptor to nodes with static data.
"""
def __init__(self, parent, cr, mode, ctx=None):
@@ -1528,7 +1528,7 @@ class nodefd_static(StringIO, node_descriptor):
StringIO.__init__(self, None)
else:
_logger.error("Incorrect mode %s is specified.", mode)
- raise IOError(errno.EINVAL, "Invalid file mode!")
+ raise IOError(errno.EINVAL, "Invalid file mode.")
self.mode = mode
def size(self):