summaryrefslogtreecommitdiff
path: root/meetingtools
diff options
context:
space:
mode:
authorLeif Johansson <leifj@sunet.se>2013-03-04 06:57:42 +0100
committerLeif Johansson <leifj@sunet.se>2013-03-04 06:57:42 +0100
commit7532175aa361b5c8e6c9f28e82acfa705f325aee (patch)
tree6a44d2576217dc493ad799246d624ce2d6f7a31f /meetingtools
parentcdb3e4a60ddfd9c732e336a28d3dc8c38dbc202e (diff)
handle differences between report-bulk-objects and sco-contents
Diffstat (limited to 'meetingtools')
-rw-r--r--meetingtools/apps/room/tasks.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/meetingtools/apps/room/tasks.py b/meetingtools/apps/room/tasks.py
index ecf6ee3..92d1cc7 100644
--- a/meetingtools/apps/room/tasks.py
+++ b/meetingtools/apps/room/tasks.py
@@ -96,15 +96,23 @@ def _import_one_room(acc,api,row):
#logging.debug("last %s" % last)
#logging.debug("lastupdated %s" % lastupdated)
if not room or lastupdated < last:
- (r,username) = _extended_info(api, acc, sco_id)
+ (r, username) = _extended_info(api, acc, sco_id)
logging.debug("found room owned by %s. Time for an update" % username)
if username is None:
logging.warning("username not found for sco-id=%s while importing" % sco_id)
return
+ def _ft(t,*exprs):
+ for e in exprs:
+ v = t.findtext(exprs)
+ if v is not None:
+ return v
+ return None
+
logging.debug(etree.tostring(row))
logging.debug(etree.tostring(r))
- urlpath = row.findtext("url[0]").strip("/")
+ urlpath = _ft(row, "url[0]", "url-path[0]").strip("/")
+
name = row.findtext('name[0]')
description = row.findtext('description[0]')
date_created = None
@@ -130,7 +138,7 @@ def _import_one_room(acc,api,row):
if room is None:
if folder_sco_id:
- user,created = User.objects.get_or_create(username=username)
+ user, created = User.objects.get_or_create(username=username)
if created:
user.set_unusable_password()
room = Room.objects.create(sco=get_sco(acc,sco_id),