diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 2a0b0cc60ad..a37630f8d96 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1017,7 +1017,8 @@ class calendar_event(osv.osv): elif int(val.get('interval')) > 1: #If interval is other than 1 rule is custom rrule_type = 'custom' - qry = "UPDATE %(table)s set rrule_type=\'%(rule_type)s\' " + qry = "UPDATE \"%s\" set rrule_type=%%s " % self._table + qry_args = [ rrule_type, ] if rrule_type == 'custom': new_val = val.copy() @@ -1055,17 +1056,12 @@ class calendar_event(osv.osv): new_val.pop('bymonth') for k, v in new_val.items(): - temp = ", %s='%s'" % (k, v) - qry += temp + qry += ", %s=%%s" % k + qry_args.append(v) - whr = " where id=%(id)s" - qry = qry + whr - val.update({ - 'table': self._table, - 'rule_type': rrule_type, - 'id': id, - }) - cr.execute(qry, val) # Hopefully psycopg2 works with dicts. But, FIXME + qry = qry + " where id=%s" + qry_args.append(id) + cr.execute(qry, qry_args) return True def _get_rulestring(self, cr, uid, ids, name, arg, context=None): diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index 276f08c5f51..ae9aa909642 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -71,7 +71,8 @@ def uid2openobjectid(cr, uidval, oomodel, rdate): r_id = cr.fetchone() if r_id: return (id, r_id[0]) - + else: + return (False, None) cr.execute(qry) ids = map(lambda x: str(x[0]), cr.fetchall()) if id in ids: