示例#1
0
文件: krest.py 项目: fatiherikli/kule
 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({})
示例#2
0
文件: krest.py 项目: yutiansut/kule
 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({})
示例#3
0
文件: krest.py 项目: fatiherikli/kule
def error401(error=None):
    """ standard error messages should still be json """
    return jsonify(dict(error=401, text='Unauthorized'))
示例#4
0
文件: krest.py 项目: fatiherikli/kule
def error404(error=None):
    """ standard error messages should still return json """
    return jsonify(dict(error=404, text=error or 'Nothing here'))
示例#5
0
文件: krest.py 项目: fatiherikli/kule
 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])
示例#6
0
文件: krest.py 项目: yutiansut/kule
def error401(error=None):
    """ standard error messages should still be json """
    return jsonify(dict(error=401, text='Unauthorized'))
示例#7
0
文件: krest.py 项目: yutiansut/kule
def error404(error=None):
    """ standard error messages should still return json """
    return jsonify(dict(error=404, text=error or 'Nothing here'))
示例#8
0
文件: krest.py 项目: yutiansut/kule
 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])