[IMP] base_calendar: avoid creating context object twice when context dict is empty...
authorolt@tinyerp.com <>
Thu, 21 Oct 2010 06:50:03 +0000 (08:50 +0200)
committerolt@tinyerp.com <>
Thu, 21 Oct 2010 06:50:03 +0000 (08:50 +0200)
bzr revid: olt@tinyerp.com-20101021065003-xo2whz2zn0orqgqz

addons/base_calendar/base_calendar.py

index df5aaa4..7d31e9a 100644 (file)
@@ -477,7 +477,7 @@ property or property parameter."),
         @param context: A standard dictionary for contextual values
         @return: True
         """
-        if not context:
+        if context is None:
             context = {}
 
         company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name
@@ -555,7 +555,7 @@ property or property parameter."),
         @param context: A standard dictionary for contextual values
         @return: True
         """
-        if not context:
+        if context is None:
             context = {}
 
         for vals in self.browse(cr, uid, ids, context=context):
@@ -575,7 +575,7 @@ property or property parameter."),
         @param ids: List of calendar attendee’s IDs
         @param *args: Get Tupple value
         @param context: A standard dictionary for contextual values """
-        if not context:
+        if context is None:
             context = {}
         return self.write(cr, uid, ids, {'state': 'declined'}, context)
 
@@ -587,7 +587,7 @@ property or property parameter."),
         @param vals: Get Values
         @param context: A standard dictionary for contextual values """
 
-        if not context:
+        if context is None:
             context = {}
         if not vals.get("email") and vals.get("cn"):
             cnval = vals.get("cn").split(':')
@@ -641,7 +641,7 @@ true, it will allow you to hide the event alarm information without removing it.
         @param context: A standard dictionary for contextual values
         @return: True
         """
-        if not context:
+        if context is None:
             context = {}
         alarm_obj = self.pool.get('calendar.alarm')
         res_alarm_obj = self.pool.get('res.alarm')
@@ -713,7 +713,7 @@ true, it will allow you to hide the event alarm information without removing it.
         @param model: Model name for which alarm is to be cleared.
         @return: True
         """
-        if not context:
+        if context is None:
             context = {}
         alarm_obj = self.pool.get('calendar.alarm')
         ir_obj = self.pool.get('ir.model')
@@ -781,7 +781,7 @@ class calendar_alarm(osv.osv):
         @param context: A standard dictionary for contextual values
         @return: new record id for calendar_alarm.
         """
-        if not context:
+        if context is None:
             context = {}
         event_date = vals.get('event_date', False)
         if event_date:
@@ -808,7 +808,7 @@ class calendar_alarm(osv.osv):
         @param context: A standard dictionary for contextual values
         """
         return True # XXX FIXME REMOVE THIS AFTER FIXING get_recurrent_dates!!
-        if not context:
+        if context is None:
             context = {}
         current_datetime = datetime.now()
         request_obj = self.pool.get('res.request')
@@ -943,7 +943,7 @@ class calendar_event(osv.osv):
         @param end_date: Ending Datee
         @param context: A standard dictionary for contextual values
         """
-        if not context:
+        if context is None:
             context = {}
         value = {}
         if not start_date:
@@ -975,7 +975,7 @@ class calendar_event(osv.osv):
         This function deletes event which are linked with the event with recurrent_uid
                 (Removes the events which refers to the same UID value)
         """
-        if not context:
+        if context is None:
             context = {}
         for event_id in ids:
             cr.execute("select id from %s where recurrent_uid=%%s" % (self._table), (event_id,))
@@ -992,7 +992,7 @@ class calendar_event(osv.osv):
         @param context: A standard dictionary for contextual values
         @return: dictionary of rrule value.
         """
-        if not context:
+        if context is None:
             context = {}
         cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\
                     mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\
@@ -1203,7 +1203,7 @@ true, it will allow you to hide the event alarm information without removing it.
         @param context: A standard dictionary for contextual values
         @return: Dictionary value which open Crm Meeting form.
         """
-        if not context:
+        if context is None:
             context = {}
 
         data_obj = self.pool.get('ir.model.data')
@@ -1448,7 +1448,7 @@ true, it will allow you to hide the event alarm information without removing it.
         @param context: A standard dictionary for contextual values
         @return: True
         """
-        if not context:
+        if context is None:
             context = {}
         if isinstance(ids, (str, int, long)):
             select = [ids]
@@ -1520,7 +1520,7 @@ true, it will allow you to hide the event alarm information without removing it.
         @return: List of Dictionary of form [{‘name_of_the_field’: value, ...}, ...]
         """
         # FIXME This whole id mangling has to go!
-        if not context:
+        if context is None:
             context = {}
 
         if isinstance(ids, (str, int, long)):
@@ -1558,7 +1558,7 @@ true, it will allow you to hide the event alarm information without removing it.
         @param context: A standard dictionary for contextual values
         @return: Duplicate record id.
         """
-        if not context:
+        if context is None:
             context = {}
         res = super(calendar_event, self).copy(cr, uid, base_calendar_id2real_id(id), default, context)
         alarm_obj = self.pool.get('res.alarm')
@@ -1607,7 +1607,7 @@ true, it will allow you to hide the event alarm information without removing it.
         @param context: A standard dictionary for contextual values
         @return: new created record id.
         """
-        if not context:
+        if context is None:
             context = {}
         if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'):
             vals['vtimezone'] = vals['vtimezone'][40:]
@@ -1770,7 +1770,7 @@ class ir_values(osv.osv):
         @param uid: the current user’s ID for security checks,
         @param model: Get The Model
         """
-        if not context:
+        if context is None:
             context = {}
         new_model = []
         for data in models:
@@ -1798,7 +1798,7 @@ class ir_model(osv.osv):
         @param context: A standard dictionary for contextual values
         """
         new_ids = isinstance(ids, (str, int, long)) and [ids] or ids
-        if not context:
+        if context is None:
             context = {}
         data = super(ir_model, self).read(cr, uid, new_ids, fields=fields, \
                         context=context, load=load)