← Back to team overview

eficent team mailing list archive

lp:~therp-nl/eficent-openerp-project-management/6.1-remove_mutable_defaults_in_method_args into lp:eficent-openerp-project-management/6.1

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/eficent-openerp-project-management/6.1-remove_mutable_defaults_in_method_args into lp:eficent-openerp-project-management/6.1.

Requested reviews:
  Eficent (eficent)

For more details, see:
https://code.launchpad.net/~therp-nl/eficent-openerp-project-management/6.1-remove_mutable_defaults_in_method_args/+merge/141922
-- 
https://code.launchpad.net/~therp-nl/eficent-openerp-project-management/6.1-remove_mutable_defaults_in_method_args/+merge/141922
Your team Eficent is requested to review the proposed merge of lp:~therp-nl/eficent-openerp-project-management/6.1-remove_mutable_defaults_in_method_args into lp:eficent-openerp-project-management/6.1.
=== modified file 'project_category/analytic_account_category.py'
--- project_category/analytic_account_category.py	2012-10-18 23:30:03 +0000
+++ project_category/analytic_account_category.py	2013-01-04 14:24:25 +0000
@@ -40,7 +40,7 @@
     def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
         if not args:
             args=[]
-        if not context:
+        if context is None:
             context={}
         if name:
             # Be sure name_search is symetric to name_get
@@ -77,4 +77,4 @@
     _parent_order = 'name'
     _order = 'parent_left'
     
-analytic_account_category()
\ No newline at end of file
+analytic_account_category()

=== modified file 'project_communications_mailgate/project_communications_mailgate.py'
--- project_communications_mailgate/project_communications_mailgate.py	2012-10-02 20:55:15 +0000
+++ project_communications_mailgate/project_communications_mailgate.py	2013-01-04 14:24:25 +0000
@@ -70,7 +70,9 @@
 #
         return res           
     
-    def message_update(self, cr, uid, id, msg, data={}, context=None): 
+    def message_update(self, cr, uid, id, msg, data=None, context=None): 
+        if data is None:
+            data = {}
         mailgate_obj = self.pool.get('email.server.tools')
         subject = data.get('subject')
         body = data.get('body')
@@ -114,7 +116,9 @@
     def msg_send(self, cr, uid, id, *args, **argv):
         return True
     
-    def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context=None):
+    def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=None, context=None):
+        if attach is None:
+            attach = []
         mailgate_pool = self.pool.get('mailgate.thread')
         return mailgate_pool.history(cr, uid, cases, keyword, history=history,\
                                        subject=subject, email=email, \

=== modified file 'project_cost/account_analytic_account.py'
--- project_cost/account_analytic_account.py	2012-10-02 20:55:15 +0000
+++ project_cost/account_analytic_account.py	2013-01-04 14:24:25 +0000
@@ -33,7 +33,9 @@
     _inherit = 'account.analytic.account'
     
     def _compute_level_tree_plan(self, cr, uid, ids, child_ids, res, field_names, context=None):
-        def recursive_computation(account_id, res, repeated_account_ids=[]):
+        def recursive_computation(account_id, res, repeated_account_ids=None):
+            if repeated_account_ids is None:
+                repeated_account_ids = []
             currency_obj = self.pool.get('res.currency')
             account = self.browse(cr, uid, account_id)
             for son in account.child_ids:
@@ -54,7 +56,9 @@
         return res    
     
     def _compute_level_tree_commit(self, cr, uid, ids, child_ids, res, field_names, context=None):
-        def recursive_computation(account_id, res, repeated_account_ids=[]):
+        def recursive_computation(account_id, res, repeated_account_ids=None):
+            if repeated_account_ids is None:
+                repeated_account_ids = []
             currency_obj = self.pool.get('res.currency')
             account = self.browse(cr, uid, account_id)
             for son in account.child_ids:
@@ -200,11 +204,11 @@
         return True
     
     def copy(self, cr, uid, id, default=None, context=None):
-        if not default:
+        if default is None:
             default = {}        
         default['plan_line_ids'] = []
         default['commit_line_ids'] = []
         return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
     
                 
-account_analytic_account()
\ No newline at end of file
+account_analytic_account()

=== modified file 'project_cost_plan_purchase/account_analytic_line_plan.py'
--- project_cost_plan_purchase/account_analytic_line_plan.py	2012-10-02 20:55:15 +0000
+++ project_cost_plan_purchase/account_analytic_line_plan.py	2013-01-04 14:24:25 +0000
@@ -43,23 +43,23 @@
     }
 
 
-    def copy(self, cr, uid, id, default={}, context=None):
+    def copy(self, cr, uid, id, default=None, context=None):
         if context is None:
             context = {}
         
-        if not default:
+        if default is None:
             default = {}        
                 
         default['purchase_line_id'] = False
                 
         return super(account_analytic_line_plan, self).copy(cr, uid, id, default, context)
 
-    def copy_data(self, cr, uid, id, default={}, context=None):
+    def copy_data(self, cr, uid, id, default=None, context=None):
 
         if context is None:
             context = {}
         
-        if not default:
+        if default is None:
             default = {}   
                 
         default['purchase_line_id'] = False

=== modified file 'project_cost_plan_sale/account_analytic_line_plan.py'
--- project_cost_plan_sale/account_analytic_line_plan.py	2012-10-02 20:55:15 +0000
+++ project_cost_plan_sale/account_analytic_line_plan.py	2013-01-04 14:24:25 +0000
@@ -43,11 +43,11 @@
     }
 
       
-    def copy(self, cr, uid, id, default={}, context=None):
+    def copy(self, cr, uid, id, default=None, context=None):
         if context is None:
             context = {}
         
-        if not default:
+        if default is None:
             default = {}   
         
         default['sale_line_id'] = False
@@ -55,11 +55,11 @@
         res = super(account_analytic_line_plan, self).copy(cr, uid, id, default, context)
         return res
     
-    def copy_data(self, cr, uid, id, default={}, context=None):
+    def copy_data(self, cr, uid, id, default=None, context=None):
 
         if context is None:
             context = {}
-        if not default:
+        if default is None:
             default = {}   
             
         default['sale_line_id'] = False

=== modified file 'project_hr_stakeholder/project_hr_stakeholder.py'
--- project_hr_stakeholder/project_hr_stakeholder.py	2012-10-02 20:55:15 +0000
+++ project_hr_stakeholder/project_hr_stakeholder.py	2013-01-04 14:24:25 +0000
@@ -106,7 +106,7 @@
                                                         
     }
     
-    def name_get(self, cr, uid, ids, context={}):
+    def name_get(self, cr, uid, ids, context=None):
         if not ids:
             return []
         res = []

=== modified file 'project_invoice/invoice.py'
--- project_invoice/invoice.py	2012-10-02 20:55:15 +0000
+++ project_invoice/invoice.py	2013-01-04 14:24:25 +0000
@@ -32,7 +32,7 @@
 class account_invoice(osv.osv):
     _inherit = "account.invoice"
 
-    def _line_analytic_accounts_get(self, cr, uid, ids, field_name, arg, context={}):
+    def _line_analytic_accounts_get(self, cr, uid, ids, field_name, arg, context=None):
         result = {}
         for inv in self.browse(cr, uid, ids, context):
             str_data = ''

=== modified file 'project_procurement/purchase_requisition.py'
--- project_procurement/purchase_requisition.py	2012-10-02 20:55:15 +0000
+++ project_procurement/purchase_requisition.py	2013-01-04 14:24:25 +0000
@@ -25,8 +25,8 @@
 class purchase_requisition(osv.osv):
     _inherit = "purchase.requisition"
 
-    def copy_data(self, cr, uid, id, default={}, context=None):
-        if not default:
+    def copy_data(self, cr, uid, id, default=None, context=None):
+        if default is None:
             default = {}
         default.update({
             'state':'draft',

=== modified file 'project_scope_wbs/project_scope_wbs.py'
--- project_scope_wbs/project_scope_wbs.py	2012-12-13 04:18:54 +0000
+++ project_scope_wbs/project_scope_wbs.py	2013-01-04 14:24:25 +0000
@@ -29,7 +29,7 @@
 class task(osv.osv):
     _inherit = 'project.task'
 
-    def _project_complete_wbs_name(self, cr, uid, ids, prop, unknow_none, unknow_dict):
+    def _project_complete_wbs_name(self, cr, uid, ids, prop, unknow_none, context=None):
         
         if not ids:
             return []
@@ -45,14 +45,14 @@
         for task in tasks:            
             if task.project_id:
                 task_project_id = task.project_id.id
-                data_project = project_obj.read(cr, uid, task_project_id, ['complete_wbs_name'], context=[])            
+                data_project = project_obj.read(cr, uid, task_project_id, ['complete_wbs_name'], context=context)
             if data_project:
                 res.append((task.id, data_project['complete_wbs_name']))
             else:
                 res.append((task.id, ''))
         return dict(res)  
 
-    def _project_complete_wbs_code(self, cr, uid, ids, prop, unknow_none, unknow_dict):
+    def _project_complete_wbs_code(self, cr, uid, ids, prop, unknow_none, context=None):
         
         if not ids:
             return []
@@ -68,7 +68,7 @@
         for task in tasks:            
             if task.project_id:
                 task_project_id = task.project_id.id
-                data_project = project_obj.read(cr, uid, task_project_id, ['complete_wbs_code'], context=[])            
+                data_project = project_obj.read(cr, uid, task_project_id, ['complete_wbs_code'], context=context)
             if data_project:
                 res.append((task.id, data_project['complete_wbs_code']))
             else:
@@ -81,11 +81,11 @@
     _columns = {
         'project_complete_wbs_name': fields.function(_project_complete_wbs_name, method=True, type='char', string='WBS path name', size=250, help='Project Complete WBS path name',
             store={
-                'project.task': (lambda self, cr, uid, ids, c={}: ids, ['project_id'], 10),               
+                'project.task': (lambda self, cr, uid, ids, c=None: ids, ['project_id'], 10),               
             }),   
         'project_complete_wbs_code': fields.function(_project_complete_wbs_code, method=True, type='char', string='WBS path code', size=250, help='Project Complete WBS path code',
             store={
-                'project.task': (lambda self, cr, uid, ids, c={}: ids, ['project_id'], 10),               
+                'project.task': (lambda self, cr, uid, ids, c=None: ids, ['project_id'], 10),               
             }),    
                             
      }    
@@ -327,4 +327,4 @@
 
 project()
 
-             
\ No newline at end of file
+             

=== modified file 'project_time_sequence/project_time_sequence.py'
--- project_time_sequence/project_time_sequence.py	2012-10-02 20:55:15 +0000
+++ project_time_sequence/project_time_sequence.py	2013-01-04 14:24:25 +0000
@@ -112,7 +112,7 @@
        
         }
     
-    def do_link_predecessors(self, cr, uid, task_id, link_predecessors_data={}, context=None):
+    def do_link_predecessors(self, cr, uid, task_id, link_predecessors_data, context=None):
         
         task_br = self.browse(cr, uid, task_id, context=context)