当前位置: 首页>>代码示例>>Python>>正文


Python Project.get_entry_collection方法代码示例

本文整理汇总了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'
开发者ID:sweemeng,项目名称:scrapedump,代码行数:14,代码来源:test_project.py

示例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
开发者ID:sweemeng,项目名称:scrapedump,代码行数:16,代码来源:data.py

示例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})
开发者ID:sweemeng,项目名称:scrapedump,代码行数:18,代码来源:data.py

示例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})
开发者ID:sweemeng,项目名称:scrapedump,代码行数:19,代码来源:data.py

示例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})
开发者ID:sweemeng,项目名称:scrapedump,代码行数:8,代码来源:test_api.py


注:本文中的project.model.Project.get_entry_collection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。