Changeset - aa81f44c3207
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-04-28 16:55:05
madski@unity3d.com
utils: cleanup of function for extracting hook values from KALLITHEA_EXTRAS
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/utils2.py
Show inline comments
 
@@ -625,25 +625,25 @@ def get_server_url(environ):
 

	
 
def _extract_extras(env=None):
 
    """
 
    Extracts the rc extras data from os.environ, and wraps it into named
 
    Extracts the Kallithea extras data from os.environ, and wraps it into named
 
    AttributeDict object
 
    """
 
    if not env:
 
        env = os.environ
 

	
 
    try:
 
        rc_extras = json.loads(env['KALLITHEA_EXTRAS'])
 
        extras = json.loads(env['KALLITHEA_EXTRAS'])
 
    except KeyError:
 
        rc_extras = {}
 
        extras = {}
 

	
 
    try:
 
        for k in ['username', 'repository', 'locked_by', 'scm', 'make_lock',
 
                  'action', 'ip']:
 
            rc_extras[k]
 
            extras[k]
 
    except KeyError, e:
 
        raise Exception('Missing key %s in os.environ %s' % (e, rc_extras))
 
        raise Exception('Missing key %s in os.environ %s' % (e, extras))
 

	
 
    return AttributeDict(rc_extras)
 
    return AttributeDict(extras)
 

	
 

	
 
def _set_extras(extras):
0 comments (0 inline, 0 general)