Exemplo n.º 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({})
Exemplo n.º 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({})
Exemplo n.º 3
0
def error401(error=None):
    """ standard error messages should still be json """
    return jsonify(dict(error=401, text='Unauthorized'))
Exemplo n.º 4
0
def error404(error=None):
    """ standard error messages should still return json """
    return jsonify(dict(error=404, text=error or 'Nothing here'))
Exemplo n.º 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])
Exemplo n.º 6
0
def error401(error=None):
    """ standard error messages should still be json """
    return jsonify(dict(error=401, text='Unauthorized'))
Exemplo n.º 7
0
def error404(error=None):
    """ standard error messages should still return json """
    return jsonify(dict(error=404, text=error or 'Nothing here'))
Exemplo n.º 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])