app/soc/logic/system.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 26 Feb 2009 16:51:35 +0000
changeset 1516 8df06dc877aa
parent 1308 35b75ffcbb37
child 1592 4465cda55182
permissions -rw-r--r--
Do not update newly created model properties There is no real reason to favor old behavior over the current, plus the new behavior saves an extra disk write (which are expensive). Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
114
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     2
#
1308
35b75ffcbb37 Partially reverted "Update the copyright notice for 2009."
Sverre Rabbelier <srabbelier@gmail.com>
parents: 1307
diff changeset
     3
# Copyright 2008 the Melange authors.
114
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
#
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
#
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    17
"""Basic system information functions.
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
"""
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
__authors__ = [
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    21
  '"Todd Larsen" <tlarsen@google.com>',
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    22
  ]
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
578
0f34318f5693 Add release tag string, Melange "badge" image, and Google App Engine version
Todd Larsen <tlarsen@google.com>
parents: 114
diff changeset
    25
import os
114
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    26
import settings
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    28
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    29
def isDebug():
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    30
  """Returns True if Melange application is running in "debug mode".
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    31
  
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    32
  "Debug mode" is currently determined from settings.DEBUG but may become
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    33
  more sophisticated in the future.
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    34
  """
9998e95ce609 A collection of functions for determining the characteristics of the "system"
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    35
  return settings.DEBUG
578
0f34318f5693 Add release tag string, Melange "badge" image, and Google App Engine version
Todd Larsen <tlarsen@google.com>
parents: 114
diff changeset
    36
0f34318f5693 Add release tag string, Melange "badge" image, and Google App Engine version
Todd Larsen <tlarsen@google.com>
parents: 114
diff changeset
    37
def getAppVersion():
0f34318f5693 Add release tag string, Melange "badge" image, and Google App Engine version
Todd Larsen <tlarsen@google.com>
parents: 114
diff changeset
    38
  """Returns the Google App Engine "version" of the running instance.
0f34318f5693 Add release tag string, Melange "badge" image, and Google App Engine version
Todd Larsen <tlarsen@google.com>
parents: 114
diff changeset
    39
  """
0f34318f5693 Add release tag string, Melange "badge" image, and Google App Engine version
Todd Larsen <tlarsen@google.com>
parents: 114
diff changeset
    40
  return os.environ.get('CURRENT_VERSION_ID')
0f34318f5693 Add release tag string, Melange "badge" image, and Google App Engine version
Todd Larsen <tlarsen@google.com>
parents: 114
diff changeset
    41