base_calendar, caldav: fixes for the queries.

bzr revid: p_christ@hol.gr-20101012104118-o02tug6x3t9gewaa
This commit is contained in:
P. Christeas
2010-10-12 13:41:18 +03:00
parent d697bd94e5
commit 39aa2bd391
2 changed files with 9 additions and 12 deletions
+7 -11
View File
@@ -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):
+2 -1
View File
@@ -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: