diff options
| author | uco (OpenERP) <uco@tinyerp.com> | 2010-11-23 12:35:05 +0530 |
|---|---|---|
| committer | uco (OpenERP) <uco@tinyerp.com> | 2010-11-23 12:35:05 +0530 |
| commit | 6dd290e8245f4ea91ce87b0f3b5f29bafeaf12e9 (patch) | |
| tree | 81db1734d8400a9278e5669da35bbe90076397c0 /addons/document | |
| parent | 8035df3e1152a8f9d9703037d9d1bee718d94331 (diff) | |
[REF]: Replace the condition 'if not context' with 'if context is None'.
bzr revid: uco@tinyerp.com-20101123070505-9i2lrqhgxzaii3zn
Diffstat (limited to 'addons/document')
| -rw-r--r-- | addons/document/directory_content.py | 2 | ||||
| -rw-r--r-- | addons/document/directory_report.py | 2 | ||||
| -rw-r--r-- | addons/document/document.py | 10 | ||||
| -rw-r--r-- | addons/document/document_directory.py | 6 | ||||
| -rw-r--r-- | addons/document/document_storage.py | 10 | ||||
| -rw-r--r-- | addons/document/wizard/document_configuration.py | 2 |
6 files changed, 3 insertions, 29 deletions
diff --git a/addons/document/directory_content.py b/addons/document/directory_content.py index 8c0c9e0e88b..cd0c44584a7 100644 --- a/addons/document/directory_content.py +++ b/addons/document/directory_content.py @@ -110,7 +110,7 @@ class document_directory_content(osv.osv): return True def process_read(self, cr, uid, node, context=None): - if not context: + if context is None: context = {} if node.extension != '.pdf': raise Exception("Invalid content: %s" % node.extension) diff --git a/addons/document/directory_report.py b/addons/document/directory_report.py index 97d70e1a3cb..6eb18dae850 100644 --- a/addons/document/directory_report.py +++ b/addons/document/directory_report.py @@ -28,8 +28,6 @@ class ir_action_report_xml(osv.osv): def _model_get(self, cr, uid, ids, name, arg, context=None): res = {} - if not context: - context = {} model_pool = self.pool.get('ir.model') for data in self.read(cr, uid, ids, ['model']): model = data.get('model',False) diff --git a/addons/document/document.py b/addons/document/document.py index 0ccd0ec51ec..7e575f38a37 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -39,7 +39,7 @@ class document_file(osv.osv): return os.path.join(DMS_ROOT_PATH, cr.dbname) def _data_get(self, cr, uid, ids, name, arg, context=None): - if not context: + if context is None: context = {} fbrl = self.browse(cr, uid, ids, context=context) nctx = nodes.get_node_context(cr, uid, context={}) @@ -64,8 +64,6 @@ class document_file(osv.osv): def _data_set(self, cr, uid, id, name, value, arg, context=None): if not value: return True - if not context: - context = {} fbro = self.browse(cr, uid, id, context=context) nctx = nodes.get_node_context(cr, uid, context={}) fnode = nodes.node_file(None, None, nctx, fbro) @@ -140,8 +138,6 @@ class document_file(osv.osv): def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} - if not context: - context = {} if 'name' not in default: name = self.read(cr, uid, [id])[0]['name'] default.update({'name': name + " (copy)"}) @@ -233,8 +229,6 @@ class document_file(osv.osv): It is a hack that will try to discover if the mentioned record is clearly associated with a partner record. """ - if not context: - context = {} obj_model = self.pool.get(res_model) if obj_model._name == 'res.partner': return res_id @@ -249,8 +243,6 @@ class document_file(osv.osv): def unlink(self, cr, uid, ids, context=None): stor = self.pool.get('document.storage') unres = [] - if not context: - context = {} # We have to do the unlink in 2 stages: prepare a list of actual # files to be unlinked, update the db (safer to do first, can be # rolled back) and then unlink the files. The list wouldn't exist diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index a8a54955b74..1f7d1e15807 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -175,8 +175,6 @@ class document_directory(osv.osv): """ Return a node object for the given uri. This fn merely passes the call to node_context """ - if not context: - context = {} return nodes.get_node_context(cr, uid, context).get_uri(cr, uri) @@ -186,8 +184,6 @@ class document_directory(osv.osv): This function can be overriden by inherited classes ;) @param dbro The browse object, if caller already has it """ - if not context: - context = {} if dbro is None: dbro = self.browse(cr, uid, ids, context=context) @@ -237,8 +233,6 @@ class document_directory(osv.osv): def copy(self, cr, uid, id, default=None, context=None): if not default: default ={} - if not context: - context = {} name = self.read(cr, uid, [id])[0]['name'] default.update({'name': name+ " (copy)"}) return super(document_directory,self).copy(cr, uid, id, default, context=context) diff --git a/addons/document/document_storage.py b/addons/document/document_storage.py index eaa4244f10f..b61b7fd65fc 100644 --- a/addons/document/document_storage.py +++ b/addons/document/document_storage.py @@ -422,9 +422,7 @@ class document_storage(osv.osv): optionally, fil_obj could point to the browse object of the file (ir.attachment) """ - if not context: - context = {} - boo = self.browse(cr, uid, id, context) + boo = self.browse(cr, uid, id, context=context) if not boo.online: raise IOError(errno.EREMOTE, 'medium offline') @@ -540,8 +538,6 @@ class document_storage(osv.osv): This function MUST be used from an ir.attachment. It wouldn't make sense to store things persistently for other types (dynamic). """ - if not context: - context = {} boo = self.browse(cr, uid, id, context=context) if fil_obj: ira = fil_obj @@ -688,8 +684,6 @@ class document_storage(osv.osv): @return the dict of values that can safely be be stored in the db. """ - if not context: - context = {} sbro = self.browse(cr, uid, file_node.storage_id, context=context) assert sbro, "The file #%d didn't provide storage" % file_node.file_id @@ -732,8 +726,6 @@ class document_storage(osv.osv): file should move to. @return the dict of values that can safely be be stored in the db. """ - if not context: - context = {} sbro = self.browse(cr, uid, file_node.storage_id, context=context) assert sbro, "The file #%d didn't provide storage" % file_node.file_id diff --git a/addons/document/wizard/document_configuration.py b/addons/document/wizard/document_configuration.py index bc25e6bdc44..26ce8652599 100644 --- a/addons/document/wizard/document_configuration.py +++ b/addons/document/wizard/document_configuration.py @@ -33,8 +33,6 @@ class document_configuration(osv.osv_memory): def execute(self, cr, uid, ids, context=None): - if not context: - context = {} conf_id = ids and ids[0] or False conf = self.browse(cr, uid, conf_id, context=context) dir_pool = self.pool.get('document.directory') |
