Package omeroweb :: Package webadmin :: Module webadmin_utils
[hide private]
[frames] | no frames]

Source Code for Module omeroweb.webadmin.webadmin_utils

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  import logging 
 4  import traceback 
 5  import re 
 6  from omero_version import omero_version 
 7   
 8  from webclient.webclient_gateway import OmeroWebGateway 
 9   
10  logger = logging.getLogger(__name__) 
11   
12 -def upgradeCheck():
13 # upgrade check: 14 # ------------- 15 # On each startup OMERO.web checks for possible server upgrades 16 # and logs the upgrade url at the WARNING level. If you would 17 # like to disable the checks, please set 'omero.web.upgrades_url` 18 # to an empty string. 19 # 20 # For more information, see 21 # http://trac.openmicroscopy.org.uk/ome/wiki/UpgradeCheck 22 # 23 try: 24 from omero.util.upgrade_check import UpgradeCheck 25 from django.conf import settings 26 check = UpgradeCheck("web", url=settings.UPGRADES_URL) 27 check.run() 28 if check.isUpgradeNeeded(): 29 logger.error("Upgrade is available. Please visit http://trac.openmicroscopy.org.uk/ome/wiki/MilestoneDownloads.\n") 30 else: 31 logger.debug("Up to date.\n") 32 except Exception, x: 33 logger.error("Upgrade check error: %s" % x)
34
35 -def toBoolean(val):
36 """ 37 Get the boolean value of the provided input. 38 39 If the value is a boolean return the value. 40 Otherwise check to see if the value is in 41 ["false", "f", "no", "n", "none", "0", "[]", "{}", "" ] 42 and returns True if value is not in the list 43 """ 44 45 if val is True or val is False: 46 return val 47 48 falseItems = ["false", "f", "no", "n", "none", "0", "[]", "{}", "" ] 49 50 return not str( val ).strip().lower() in falseItems
51