summaryrefslogtreecommitdiff
path: root/addons/document/document_directory.py
diff options
context:
space:
mode:
authorAntonin Bourguignon <abo@openerp.com>2012-10-02 12:29:15 +0200
committerAntonin Bourguignon <abo@openerp.com>2012-10-02 12:29:15 +0200
commit165333208000e7f8b2a61fd99c0a5b1f1d242976 (patch)
tree150c1a7d2f30b4043b1cd565c40324b773fec3d5 /addons/document/document_directory.py
parent2d2a44dcf2e3b29e4fef4000792a064862967769 (diff)
parentf285c0e481d12edfc2aa9aa1fd3baeb334bc39c6 (diff)
[MERGE] trunk
bzr revid: abo@openerp.com-20121002102915-424prxd74izb1szw
Diffstat (limited to 'addons/document/document_directory.py')
-rw-r--r--addons/document/document_directory.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py
index 33f1da1125b..ec51d9bcc6c 100644
--- a/addons/document/document_directory.py
+++ b/addons/document/document_directory.py
@@ -22,10 +22,10 @@
from osv import osv, fields
from osv.orm import except_orm
-
+import logging
import nodes
from tools.translate import _
-
+_logger = logging.getLogger(__name__)
class document_directory(osv.osv):
_name = 'document.directory'
_description = 'Directory'
@@ -77,10 +77,7 @@ class document_directory(osv.osv):
return False
root_id = objid.read(cr, uid, mid, ['res_id'])['res_id']
return root_id
- except Exception, e:
- import netsvc
- logger = netsvc.Logger()
- logger.notifyChannel("document", netsvc.LOG_WARNING, 'Cannot set directory root:'+ str(e))
+ except Exception:
return False
return objid.browse(cr, uid, mid, context=context).res_id
@@ -109,7 +106,7 @@ class document_directory(osv.osv):
_sql_constraints = [
('dirname_uniq', 'unique (name,parent_id,ressource_id,ressource_parent_type_id)', 'The directory name must be unique !'),
('no_selfparent', 'check(parent_id <> id)', 'Directory cannot be parent of itself!'),
- ('dir_parented', 'check(parent_id IS NOT NULL OR storage_id IS NOT NULL)', 'Directory must have a parent or a storage')
+ ('dir_parented', 'check(parent_id IS NOT NULL OR storage_id IS NOT NULL)', 'Directory must have a parent or a storage.')
]
def name_get(self, cr, uid, ids, context=None):
res = []
@@ -154,7 +151,7 @@ class document_directory(osv.osv):
return True
_constraints = [
- (_check_recursion, 'Error! You can not create recursive Directories.', ['parent_id'])
+ (_check_recursion, 'Error! You cannot create recursive directories.', ['parent_id'])
]
def __init__(self, *args, **kwargs):
@@ -180,7 +177,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
"""
@@ -194,17 +191,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.
"""
@@ -234,7 +231,7 @@ class document_directory(osv.osv):
if not default:
default ={}
name = self.read(cr, uid, [id])[0]['name']
- default.update({'name': name+ " (copy)"})
+ default.update(name=_("%s (copy)") % (name))
return super(document_directory,self).copy(cr, uid, id, default, context=context)
def _check_duplication(self, cr, uid, vals, ids=None, op='create'):