Example #1
0
 def get_detail(self, collection, pk):
     """ Returns a single application's
         configuration for the given environment
     """
     app_name = pk
     env_name = collection
     collection = self.get_collection(env_name)
     data = collection.find_one({"app": app_name}) or {}
     data = data.copy()
     data.pop('_id', None)
     data.update(env=env_name)
     if data:
         return jsonify(data)
     else:
         return jsonify({})
Example #2
0
 def get_detail(self, collection, pk):
     """ Returns a single application's
         configuration for the given environment
     """
     app_name = pk
     env_name = collection
     collection = self.get_collection(env_name)
     data = collection.find_one({"app": app_name}) or {}
     data = data.copy()
     data.pop('_id', None)
     data.update(env=env_name)
     if data:
         return jsonify(data)
     else:
         return jsonify({})
Example #3
0
def error401(error=None):
    """ standard error messages should still be json """
    return jsonify(dict(error=401, text='Unauthorized'))
Example #4
0
def error404(error=None):
    """ standard error messages should still return json """
    return jsonify(dict(error=404, text=error or 'Nothing here'))
Example #5
0
 def get_list(self, collection):
     """Returns a list of app names """
     env_name = collection
     collection = self.get_collection(env_name)
     collection = collection.find({})
     return jsonify( [ x.get('app', x['_id' ] ) for x in collection])
Example #6
0
def error401(error=None):
    """ standard error messages should still be json """
    return jsonify(dict(error=401, text='Unauthorized'))
Example #7
0
def error404(error=None):
    """ standard error messages should still return json """
    return jsonify(dict(error=404, text=error or 'Nothing here'))
Example #8
0
 def get_list(self, collection):
     """Returns a list of app names """
     env_name = collection
     collection = self.get_collection(env_name)
     collection = collection.find({})
     return jsonify([x.get('app', x['_id']) for x in collection])