Package commons :: Module environ
[hide private]
[frames] | no frames]

Source Code for Module commons.environ

 1  # -*- mode: python; tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4; -*- 
 2  # vim:ft=python:et:sw=4:ts=4 
 3   
 4  """ 
 5  Environment variables. 
 6  """ 
 7   
 8  import os 
 9   
10 -def get_environs( *names ):
11 """ 12 Get the value from a prioritized ordering of environment 13 variables. 14 15 @param names: The names of the environment variables to scan. 16 @type names: str 17 18 @return: The value of the first variable that is set, or None if 19 none are set. 20 @rtype: str 21 """ 22 for name in names: 23 try: 24 return os.environ[ name ] 25 except KeyError: 26 pass 27 else: 28 return None
29