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  # 
 3  # 
 4  # Copyright (C) 2011 University of Dundee & Open Microscopy Environment. 
 5  # All rights reserved. 
 6  # 
 7  # This program is free software: you can redistribute it and/or modify 
 8  # it under the terms of the GNU Affero General Public License as 
 9  # published by the Free Software Foundation, either version 3 of the 
10  # License, or (at your option) any later version. 
11  # 
12  # This program is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU Affero General Public License for more details. 
16  # 
17  # You should have received a copy of the GNU Affero General Public License 
18  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
19  # 
20   
21  import settings 
22  import logging 
23  logger = logging.getLogger('utils') 
24   
25 -def _formatReport(delete_handle):
26 """ 27 Added as workaround to the changes made in #3006. 28 """ 29 delete_reports = delete_handle.report() 30 for report in delete_reports: 31 if report.error or report.warning: 32 return "Operation could not be completed successfully"
33 34 # Might want to take advantage of other feedback here 35
36 -def _purgeCallback(request):
37 38 callbacks = request.session.get('callback').keys() 39 if len(callbacks) > 200: 40 for (cbString, count) in zip(request.session.get('callback').keys(), range(0,len(callbacks)-200)): 41 del request.session['callback'][cbString]
42
43 -def string_to_dict(string):
44 kwargs = {} 45 if string: 46 string = str(string) 47 if '|' not in string: 48 # ensure at least one ',' 49 string += '|' 50 for arg in string.split('|'): 51 arg = arg.strip() 52 if arg == '': continue 53 kw, val = arg.split('=', 1) 54 kwargs[kw] = val 55 return kwargs
56