本文整理汇总了Python中project.model.Project.get_entry_collection方法的典型用法代码示例。如果您正苦于以下问题:Python Project.get_entry_collection方法的具体用法?Python Project.get_entry_collection怎么用?Python Project.get_entry_collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类project.model.Project
的用法示例。
在下文中一共展示了Project.get_entry_collection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_data
# 需要导入模块: from project.model import Project [as 别名]
# 或者: from project.model.Project import get_entry_collection [as 别名]
def test_load_data():
project = Project()
project.find('test load data')
entry_id = project.find_entry('test entries')
datasource = project.project.input_file[entry_id]
key = datasource.keys()[0]
entry = project.get_entry_collection(entry_id)
print key
project.load_datafile(entry_id,key)
test_data = entry.query({'a':'1'})
assert test_data['b'] == '2'
assert test_data['c'] == '3'
示例2: get
# 需要导入模块: from project.model import Project [as 别名]
# 或者: from project.model.Project import get_entry_collection [as 别名]
def get(self, project_id, entry, entry_id):
project = Project()
project.get(project_id)
model = project.get_entry_collection(entry)
if entry_id:
id = objectid.ObjectId(str(entry_id))
result = model.query({"_id": id})
else:
result = model.all()
data = json.dumps(result, default=bson.json_util.default)
resp = Response(data, status=200, mimetype="application/json")
resp.headers["Link"] = "http://localhost:5000"
return resp
示例3: delete
# 需要导入模块: from project.model import Project [as 别名]
# 或者: from project.model.Project import get_entry_collection [as 别名]
def delete(self, project_id, entry, entry_id):
api_key = request.args.get("api_key")
if not authorized(api_key, project_id):
return jsonify({"status": False})
# if project not in user.user.project:
# return jsonify({'status':False})
id = objectid.ObjectId(str(entry_id))
project = Project()
project.get(project_id)
model = project.get_entry_collection(entry)
model.delete({"_id": id})
project.entry_updated()
return jsonify({"status": True})
示例4: post
# 需要导入模块: from project.model import Project [as 别名]
# 或者: from project.model.Project import get_entry_collection [as 别名]
def post(self, project_id, entry):
api_key = request.args.get("api_key")
if not authorized(api_key, project_id):
return jsonify({"status": False, "message": "user is not authenticated"})
# Lets disable it for now. Until flask-principal is implemented
# if project not in user.user.project:
# return jsonify({'status':False,'message':'user don nott have access to project'})
project = Project()
project.get(project_id)
model = project.get_entry_collection(entry)
model.insert(request.json)
project.entry_updated()
return jsonify({"status": True})
示例5: setup_test_get
# 需要导入模块: from project.model import Project [as 别名]
# 或者: from project.model.Project import get_entry_collection [as 别名]
def setup_test_get():
project = Project()
project.create('scraped','test scraping')
entry_id = project.add_entry('entry','test entry','entry','entry')
model = project.get_entry_collection(entry_id)
model.insert({'a':1})