From 9d2162f256ce2b4e1c2f34ba5c397130eb553762 Mon Sep 17 00:00:00 2001 From: Leif Johansson Date: Mon, 4 Mar 2013 06:24:54 +0100 Subject: import loop fix --- meetingtools/apps/room/tasks.py | 11 +++++++++-- meetingtools/apps/room/views.py | 9 --------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'meetingtools/apps/room') 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: -- cgit v1.1