diff options
author | Leif Johansson <leifj@sunet.se> | 2013-03-04 06:24:54 +0100 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2013-03-04 06:24:54 +0100 |
commit | 9d2162f256ce2b4e1c2f34ba5c397130eb553762 (patch) | |
tree | c1ace8a1e80d4a7b8a8ea5e5ff2999a95b3ef4a3 /meetingtools | |
parent | 2a82323101582ce11e19197b812143d01b6e820c (diff) |
import loop fix
Diffstat (limited to 'meetingtools')
-rw-r--r-- | meetingtools/apps/room/tasks.py | 11 | ||||
-rw-r--r-- | meetingtools/apps/room/views.py | 9 |
2 files changed, 9 insertions, 11 deletions
diff --git a/meetingtools/apps/room/tasks.py b/meetingtools/apps/room/tasks.py index 59b3bea..91becae 100644 --- a/meetingtools/apps/room/tasks.py +++ b/meetingtools/apps/room/tasks.py @@ -5,7 +5,6 @@ Created on Jan 18, 2012 ''' from celery.task import periodic_task,task from celery.schedules import crontab -from meetingtools.apps.room.views import user_meeting_folder from meetingtools.apps.sco.models import get_sco from meetingtools.apps.cluster.models import ACCluster from meetingtools.ac import ac_api_client @@ -157,8 +156,16 @@ def _import_one_room(acc,api,row): room.unlock() +def _user_meeting_folder(user,api): + userid = user.username + folders = api.request('sco-search-by-field', + {'filter-type': 'folder', 'field': 'name', 'query': userid}).et.xpath('//sco[folder-name="User Meetings"]') + logging.debug("user meetings folder: "+pformat(folders)) + #folder = next((f for f in folders if f.findtext('.//folder-name') == 'User Meetings'), None) + return folders[0].get('sco-id') + def import_user_rooms(api, user): - mf_sco_id = user_meeting_folder(user, api) + mf_sco_id = _user_meeting_folder(user, api) if mf_sco_id > 0: r = api.request('sco_contents', {'filter-type': 'meeting', 'sco_id': mf_sco_id}) nr = 0 diff --git a/meetingtools/apps/room/views.py b/meetingtools/apps/room/views.py index ea8b0fc..dd7e2b1 100644 --- a/meetingtools/apps/room/views.py +++ b/meetingtools/apps/room/views.py @@ -46,15 +46,6 @@ def _user_meeting_folder(request,acc): return session(request,'my_meetings_sco_id') - -def user_meeting_folder(user,api): - userid = user.username - folders = api.request('sco-search-by-field', - {'filter-type': 'folder', 'field': 'name', 'query': userid}).et.xpath('//sco[folder-name="User Meetings"]') - logging.debug("user meetings folder: "+pformat(folders)) - #folder = next((f for f in folders if f.findtext('.//folder-name') == 'User Meetings'), None) - return folders[0].get('sco-id') - def _user_templates(request,acc,folder_sco): templates = [] with ac_api_client(acc) as api: |