Package omeroweb :: Package webclient :: Module webclient_utils
[hide private]
[frames] | no frames]

Source Code for Module omeroweb.webclient.webclient_utils

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  # 
 4  # 
 5  # Copyright (C) 2011 University of Dundee & Open Microscopy Environment. 
 6  # All rights reserved. 
 7  # 
 8  # This program is free software: you can redistribute it and/or modify 
 9  # it under the terms of the GNU Affero General Public License as 
10  # published by the Free Software Foundation, either version 3 of the 
11  # License, or (at your option) any later version. 
12  # 
13  # This program is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU Affero General Public License for more details. 
17  # 
18  # You should have received a copy of the GNU Affero General Public License 
19  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
20  # 
21   
22  import settings 
23  import logging 
24   
25  from django.utils.datastructures import SortedDict 
26   
27  logger = logging.getLogger(__name__) 
28   
29 -def _formatReport(callback):
30 """ 31 Added as workaround to the changes made in #3006. 32 """ 33 rsp = callback.getResponse() 34 if not rsp: 35 return # Unfinished 36 37 import omero 38 if isinstance(rsp, omero.cmd.ERR): 39 err = rsp.parameters.get("Error", "") 40 warn = rsp.parameters.get("Warning", "") 41 logger.error('Format report: %r' % {'error':err, 'warning':warn}) 42 return "Operation could not be completed successfully" 43 else: 44 for rsp in rsp.responses: 45 if rsp.warning: 46 logger.warning("Delete warning: %s" % rsp.warning)
47 # Might want to take advantage of other feedback here 48
49 -def _purgeCallback(request):
50 51 callbacks = request.session.get('callback').keys() 52 if len(callbacks) > 200: 53 for (cbString, count) in zip(request.session.get('callback').keys(), range(0,len(callbacks)-200)): 54 del request.session['callback'][cbString]
55