diff options
author | Johan Lundberg <lundberg@nordu.net> | 2014-03-31 18:05:56 +0200 |
---|---|---|
committer | Johan Lundberg <lundberg@nordu.net> | 2014-03-31 18:05:56 +0200 |
commit | 177ba78c5f1ac2d13910d3ab9b7dd28a3363fe22 (patch) | |
tree | 9bdd90511fb4ef67aa0de00e9343d3778a5a55c9 /meetingtools/apps/content | |
parent | f8f72ba653017e90a28f02cf2cefe1d3d5016986 (diff) |
Import for objects now returns most of what we want.
Diffstat (limited to 'meetingtools/apps/content')
-rw-r--r-- | meetingtools/apps/content/tasks.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/meetingtools/apps/content/tasks.py b/meetingtools/apps/content/tasks.py index 723db0c..ddee09e 100644 --- a/meetingtools/apps/content/tasks.py +++ b/meetingtools/apps/content/tasks.py @@ -26,11 +26,8 @@ def get_owner(api, acc, sco): if parent is not None: if parent.findtext('name') in default_folders: owner = { - 'name': sco.findtext('name'), + 'login': sco.findtext('name'), # To match api.get_owner 'sco_id': sco.get('sco-id'), - # If the object is a child of a default_folder we need the parent to set as owner - 'parent_name': parent.findtext('name'), - 'parent_sco_id': parent.get('sco-id') } else: owner = get_owner(api, acc, parent) @@ -59,19 +56,21 @@ def import_acc(acc, since=0): if byte_count or byte_count == 0: sco_element = api.get_sco_info(sco_id) if not sco_element.get('source-sco-id'): # Object is not a reference - owner = get_owner(api, acc, sco_element) - permissions = api.get_permissions(sco_id) + owner = api.get_owner(sco_element.findtext('url-path')) + if not owner: + owner = get_owner(api, acc, sco_element) + views = api.get_sco_views(sco_id) item = { - 'byte_count': byte_count, - 'sco-id': row.get('sco-id'), + 'sco-id': sco_id, + 'folder-id': sco_element.get('folder-id'), 'type': row.get('icon'), 'name': row.findtext('name'), + 'byte_count': byte_count, + 'url-path': row.findtext('url'), 'created': row.findtext('date-created'), 'modified': row.findtext('date-modified'), - 'owner': owner['name'], - 'owner_sco_id': owner['sco_id'], - 'owner_parent': owner['parent_name'], - 'permissions': permissions + 'owner': owner, + 'views': views, } result.append(item) nr += 1 |