[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
This commit is contained in:
Antonin Bourguignon 2012-08-06 19:08:41 +02:00
parent d928b07ace
commit a52eeef519
15 changed files with 252 additions and 252 deletions

View File

@ -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__)

View File

@ -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 _
@ -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') " \

View File

@ -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):
@ -193,7 +193,7 @@ 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

View File

@ -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):
@ -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):
@ -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()
@ -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,7 +420,7 @@ 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
@ -435,10 +435,10 @@ 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':
@ -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',
@ -481,7 +481,7 @@ class document_storage(osv.osv):
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
@ -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
@ -684,10 +684,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.")
if sbro.type in ('filestore', 'db', 'db64'):
# nothing to do for a rename, allow to change the db field
@ -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
@ -775,7 +775,7 @@ class document_storage(osv.osv):
return { 'store_fname': store_fname }
else:
raise TypeError("No %s storage!" % sbro.type)
raise TypeError("No %s storage." % sbro.type)
document_storage()

View File

@ -340,7 +340,7 @@ 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):
@ -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
@ -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 = {
@ -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):
@ -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):

View File

@ -303,7 +303,7 @@ class abstracted_fs(object):
raise
if not uid:
cr.close()
raise OSError(2, 'Authentification is Required!')
raise OSError(2, 'Authentification required.')
n = get_node_context(cr, uid, {})
node = n.get_uri(cr, p_parts[1:])
return (cr, node, rem_path)
@ -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):

View File

@ -302,13 +302,13 @@ class DummyAuthorizer:
provide customized response strings when user log-in and quit.
"""
if self.has_user(username):
raise AuthorizerError('User "%s" already exists!' %username)
raise AuthorizerError('User "%s" already exists.' %username)
homedir = os.path.realpath(homedir)
if not os.path.isdir(homedir):
raise AuthorizerError('No such directory: "%s"!' %homedir)
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 are 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):
@ -767,7 +767,7 @@ class DTPHandler(asyncore.dispatcher):
# some other exception occurred; we don't want to provide
# confidential error messages
logerror(traceback.format_exc())
error = "Internal error!"
error = "Internal error."
self.cmd_channel.respond("426 %s; transfer aborted." %error)
self.close()
@ -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."""
@ -2150,7 +2150,7 @@ class FTPHandler(asynchat.async_chat):
datacr = self.get_crdata2(line, mode='list')
# RFC-3659 requires 501 response code if path is not a directory
if not self.fs.isdir(datacr[1]):
err = 'No such directory!'
err = 'No such directory.'
self.log('FAIL MLSD "%s". %s.' %(line, err))
self.respond("501 %s." %err)
return
@ -2191,7 +2191,7 @@ class FTPHandler(asynchat.async_chat):
fd.seek(self.restart_position)
ok = 1
except AssertionError:
why = "Invalid REST parameter!"
why = "Invalid REST parameter."
except IOError, err:
why = _strerror(err)
self.restart_position = 0
@ -2240,7 +2240,7 @@ class FTPHandler(asynchat.async_chat):
fd.seek(self.restart_position)
ok = 1
except AssertionError:
why = "Invalid REST parameter!"
why = "Invalid REST parameter."
except IOError, err:
why = _strerror(err)
self.restart_position = 0
@ -2760,7 +2760,7 @@ class FTPHandler(asynchat.async_chat):
def ftp_OPTS(self, line):
"""Specify options for FTP commands as specified in RFC-2389."""
try:
assert (not line.count(' ') > 1), 'Invalid number of arguments!'
assert (not line.count(' ') > 1), 'Invalid number of arguments.'
if ' ' in line:
cmd, arg = line.split(' ')
assert (';' in arg), 'Invalid argument!'

View File

@ -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
@ -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()
@ -755,7 +755,7 @@ class openerp_dav_handler(dav_interface):
res = self._try_function(node.rm, (cr,), "rm %s" % uri, cr=cr)
if not res:
if cr: cr.close()
raise OSError(1, 'Operation not permited.')
raise OSError(1, 'Operation not permitted.')
cr.commit()
cr.close()
return 204

View File

@ -43,7 +43,7 @@ class document_davdir(osv.osv):
elif dbro.type == 'ressource':
return nodes.node_res_dir
else:
raise ValueError("Directory 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

View File

@ -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("cannot print xml", exc_info=True)
_logger.warning("Cannot print XML.", exc_info=True)
pass
conn.close()
return r1.status, r1.msg, data1

View File

@ -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

View File

@ -149,7 +149,7 @@ class edi_document(osv.osv):
module = edi_document.get('__import_module') or edi_document.get('__module')
assert module, 'a `__module` or `__import_module` attribute is required in each EDI document.'
if module != 'base' and not ir_module.search(cr, uid, [('name','=',module),('state','=','installed')]):
raise osv.except_osv(_('Missing Application !'),
raise osv.except_osv(_('Missing application.'),
_("The document you are trying to import requires the OpenERP `%s` application. "
"You can install it by connecting as the administrator and opening the configuration assistant.")%(module,))
model = edi_document.get('__import_model') or edi_document.get('__model')
@ -276,7 +276,7 @@ class EDIMixin(object):
# this could happen for data records defined in a module that depends
# on the module that owns the model, e.g. purchase defines
# product.pricelist records.
_logger.debug('Mismatching module! expected %s, got %s, for %s.',
_logger.debug('Mismatching module: expected %s, got %s, for %s.',
module, record._original_module, record)
# ID is unique cross-db thanks to db_uuid
module = "%s:%s" % (module, db_uuid)
@ -593,12 +593,12 @@ class EDIMixin(object):
target = self._edi_get_object_by_external_id(cr, uid, external_id, model, context=context)
need_new_ext_id = False
if not target:
_logger.debug("%s: Importing EDI relationship [%r,%r] - ID is not found, trying name_get.",
_logger.debug("%s: Importing EDI relationship [%r,%r] - ID not found, trying name_get.",
self._name, external_id, value)
target = self._edi_get_object_by_name(cr, uid, value, model, context=context)
need_new_ext_id = True
if not target:
_logger.debug("%s: Importing EDI relationship [%r,%r] - name is not found, creating it!",
_logger.debug("%s: Importing EDI relationship [%r,%r] - name not found, creating it.",
self._name, external_id, value)
# also need_new_ext_id here, but already been set above
model = self.pool.get(model)

View File

@ -74,7 +74,7 @@ class google_login(osv.osv_memory):
}
self.pool.get('res.users').write(cr, uid, uid, res, context=context)
else:
raise osv.except_osv(_('Error'), _("Authentication failed. Check the user and password !"))
raise osv.except_osv(_('Error'), _("Authentication failed. Check the user and password."))
return self._get_next_action(cr, uid, context=context)

View File

@ -65,7 +65,7 @@ class change_production_qty(osv.osv_memory):
@return:
"""
record_id = context and context.get('active_id',False)
assert record_id, _('Active Id is not found')
assert record_id, _('Active Id not found')
prod_obj = self.pool.get('mrp.production')
bom_obj = self.pool.get('mrp.bom')
for wiz_qty in self.browse(cr, uid, ids, context=context):

View File

@ -38,7 +38,7 @@ class repair_cancel(osv.osv_memory):
if context is None:
context = {}
record_id = context and context.get('active_id', False) or False
assert record_id, _('Active ID is not Found')
assert record_id, _('Active ID not Found')
repair_order_obj = self.pool.get('mrp.repair')
repair_line_obj = self.pool.get('mrp.repair.line')
repair_order = repair_order_obj.browse(cr, uid, record_id, context=context)