commit/galaxy-central: carlfeberhard: Configuration API: clean up controller interface
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/587d6d4cc0ac/ Changeset: 587d6d4cc0ac User: carlfeberhard Date: 2014-04-14 17:01:15 Summary: Configuration API: clean up controller interface Affected #: 1 file diff -r 6ae3b10ec63e21b0df60f9428ab312ecad0e4e62 -r 587d6d4cc0accb1d0e8aa030e655190e411fbc17 lib/galaxy/webapps/galaxy/api/configuration.py --- a/lib/galaxy/webapps/galaxy/api/configuration.py +++ b/lib/galaxy/webapps/galaxy/api/configuration.py @@ -38,23 +38,11 @@ Note: a more complete list is returned if the user is an admin. """ - try: - config = trans.app.config - options = self._get_options( config, self.EXPOSED_USER_OPTIONS ) - if trans.user_is_admin(): - options.update( self._get_options( config, self.EXPOSED_ADMIN_OPTIONS ) ) - return options + return self.get_config_dict( trans.app.config, is_admin=trans.user_is_admin() ) - except Exception, exception: - log.error( 'could not get configuration: %s', str( exception ), exc_info=True ) - trans.response.status = 500 - return { 'error': str( exception ) } - - def _get_options( self, config, keys ): - """ - Build and return a subset of the config dictionary restricted to the - list `keys`. - - The attribute value will default to None if not available. - """ - return dict( [ (key, getattr( config, key, None ) ) for key in keys ] ) + def get_config_dict( self, config, is_admin=False ): + options = self.EXPOSED_USER_OPTIONS + if is_admin: + options.extend( self.EXPOSED_ADMIN_OPTIONS ) + config_dict = dict( [ ( key, getattr( config, key, None ) ) for key in options ] ) + return config_dict Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org