app/soc/logic/system.py
changeset 1797 f0c83ca3bb08
parent 1592 4465cda55182
child 2865 fee8732830f7
equal deleted inserted replaced
1796:5cd78a7aacdd 1797:f0c83ca3bb08
    24 
    24 
    25 import os
    25 import os
    26 import settings
    26 import settings
    27 
    27 
    28 
    28 
    29 def isDebug():
       
    30   """Returns True if Melange application is running in "debug mode".
       
    31   
       
    32   "Debug mode" is currently determined from settings.DEBUG but may become
       
    33   more sophisticated in the future.
       
    34   """
       
    35   return settings.DEBUG
       
    36 
       
    37 def getAppVersion():
    29 def getAppVersion():
    38   """Returns the Google App Engine "version" of the running instance.
    30   """Returns the Google App Engine "version" of the running instance.
    39   """
    31   """
    40 
    32 
    41   return os.environ.get('CURRENT_VERSION_ID')
    33   return os.environ.get('CURRENT_VERSION_ID')
       
    34 
       
    35 
       
    36 def getMelangeVersion():
       
    37   """Returns the Melange part of the GAE version.
       
    38   """
       
    39 
       
    40   return getAppVersion().split('.', 1)[0]
       
    41 
       
    42 
       
    43 def isLocal():
       
    44   """Returns True if Melange application is running locally.
       
    45   
       
    46   "Local mode" is currently determined from settings.DEBUG but may become
       
    47   more sophisticated in the future.
       
    48   """
       
    49 
       
    50   return settings.DEBUG
       
    51 
       
    52 
       
    53 def isDebug():
       
    54   """Returns True if Melange application is running in "debug mode".
       
    55 
       
    56   "Debug mode" is currently enabled if running locally or if the
       
    57   current Melange version is 'devvin'.
       
    58   """
       
    59 
       
    60   return isLocal() or getMelangeVersion() == 'devvin'