caldav: when creating a calendar child, return a node

bzr revid: p_christ@hol.gr-20100812111028-tntn2b1uspc64cyd
This commit is contained in:
P. Christeas
2010-08-12 14:10:28 +03:00
parent bcba71f779
commit c2fee9e691
+14 -2
View File
@@ -233,9 +233,21 @@ class node_calendar(nodes.node_class):
Return the node_* created
"""
# we ignore the path, it will be re-generated automatically
fil_obj = self.context._dirobj.pool.get('basic.calendar')
ctx = self.context.context.copy()
ctx.update(self.dctx)
uid = self.context.uid
res = self.set_data(cr, data)
# TODO: use the res to create at least one node
if res and len(res):
# We arbitrarily construct only the first node of the data
# that have been imported. ICS may have had more elements,
# but only one node can be returned here.
assert isinstance(res[0], (int, long))
fnodes = fil_obj.get_calendar_objects(cr, uid, [self.calendar_id], self,
domain=[('id','=',res[0])], context=ctx)
return fnodes[0]
return None