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