當前位置: 首頁>>代碼示例>>Python>>正文


Python model.Project類代碼示例

本文整理匯總了Python中project.model.Project的典型用法代碼示例。如果您正苦於以下問題:Python Project類的具體用法?Python Project怎麽用?Python Project使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Project類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_project_update

def test_project_update():
    project = Project()
    project.find('test project update')
    project.project.description = 'project updated'
    project.save()
    db = MongoModel(project='internal',collection='project')
    temp = db.query({'name':'test project update'})
    assert temp['description'] == 'project updated'    
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:8,代碼來源:test_project.py

示例2: setup_user_project

def setup_user_project():
    # now create user
    user = User()
    user.create('test_user_update_project','test_pass','[email protected]') 
    # create project
    project = Project()
    project.create('project update','project update content')
    # associate project
    user.add_project(project.get_id())
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:9,代碼來源:test_project_api.py

示例3: setup_project

def setup_project():
    data = (
        ('project 1','project content 1'),
        ('project 2','project content 2'),
        ('project 3','project content 3')
    )
    for d in data:
        project = Project()
        project.create(d[0],d[1])    
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:9,代碼來源:test_project_api.py

示例4: test_get_all

def test_get_all():
    project = Project()
    project.find('scraped')
    entry_id = project.find_entry('entry')
    client = webapp.app.test_client()
    response = client.get('/api/db/%s/%s/' % (project.project.id,entry_id))
    result = json.loads(response.data)
    
    assert result[0]['a'] == 1
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:9,代碼來源:test_api.py

示例5: test_project_stats

def test_project_stats():
    project = Project()
    project.find('test project db')
    entry_id = project.find_entry('test entries')
    print entry_id
    print project.project.entry
    databases = project.get_stats()
    for database in databases:
        assert database == entry_id 
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:9,代碼來源:test_project.py

示例6: teardown_project_delete

def teardown_project_delete():
    user = User()
    user.login('test_user_delete_api_project','test_pass')
    project = Project()
    model = MongoModel(project=user.project,collection=user.collection)
    model.delete({'_id':ObjectId(user.user.id)})
    project.find('project 1')
    model = MongoModel(project=project.project_,collection=project.collection_)
    model.delete({'name':'project 1'})
    model.conn.drop_database('project_1')
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:10,代碼來源:test_project_api.py

示例7: test_project_view

def test_project_view():
    test_client = webapp.app.test_client()
    result = test_client.get('/')
    project = Project()
    project.find('project view')
    assert project.project.id in result.data
    
    result = test_client.get('/project/%s/'% project.project.id)
    assert 'project view' in result.data
    assert 'data' in result.data
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:10,代碼來源:test_project_frontend.py

示例8: teardown_test_load_data

def teardown_test_load_data():
    project = Project()
    project.find('test load data') 
    fs = gridfs.GridFS(project.get_db())
    for entry in project.project.input_file:
        for file_id in project.project.input_file[entry]:
            fs.delete(ObjectId(file_id))
    db = MongoModel(project='internal',collection='project')
    
    db.delete({'name':'test load data'})
    db.conn.drop_database('test_load_data')
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:11,代碼來源:test_project.py

示例9: export_single

def export_single(project_id, entry_id, export_type):
    project = Project()
    project.get(project_id)
    exporter_list = {"json": JSONExporter, "csv": FlatCSVExporter}
    if export_type == "json":
        exporter = JSONExporter(project)
    elif export_type == "csv":
        exporter = FlatCSVExporter(project)
    else:
        raise "bad exporter"
    exporter.export(entry_id)
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:11,代碼來源:data_exporter.py

示例10: delete_data_upload

def delete_data_upload(project_id,entry_id,file_id):
    project = Project()
    project.get(project_id)
    try:
        project.delete_datafile(entry_id,file_id) 
        status = {'status':'Success','message':'completed'}
    except:
        status = {'status':'Failed','message':'error deleting file'}
        
    
    return jsonify([status])
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:11,代碼來源:action.py

示例11: get_data_upload

def get_data_upload(project_id,entry_id,file_id):
    # this will allow download of the file. 
    project = Project()
    project.get(project_id)
    metadata = project.get_datafile_metadata(entry_id,file_id)
    response = make_response(project.get_datafile(file_id).read())
    response.headers['Content-Description'] = 'Uploaded File'
    response.headers['Content-Type'] = 'application/%s' % metadata['filename'].split('.')[-1]
    response.headers['Content-Length'] = metadata['size']
    response.headers['Content-Disposition'] = 'attachment; filename=%s' % metadata['filename']
    return response 
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:11,代碼來源:action.py

示例12: download_export

def download_export(project_id,entry_id,export_type):
    project = Project()
    project.get(project_id)
    metadata = project.get_exported_file(entry_id,export_type)
    file_ = project.get_datafile(str(metadata['file_id']))
    response = make_response(file_.read())
    response.headers['Content-Description'] = 'Uploaded File'
    response.headers['Content-Type'] = 'application/%s' % file_.content_type
    response.headers['Content-Length'] = file_.length
    response.headers['Content-Disposition'] = 'attachment; filename=%s' % file_.filename
    return response 
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:11,代碼來源:action.py

示例13: teardown_project

def teardown_project():
    data = (
        ('project 1','project content 1'),
        ('project 2','project content 2'),
        ('project 3','project content 3')
    )
    for d in data:
        project = Project()
        project.find(d[0])
        model = MongoModel(project=project.project_,collection=project.collection_)
        model.delete({'_id':ObjectId(str(project.project.id))})
        model.conn.drop_database(d[0].replace(' ','_'))
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:12,代碼來源:test_project_api.py

示例14: add_entry

def add_entry(project_id):
    form = EntryForm(csrf_enabled=False)
    if form.validate_on_submit():
        project = Project()
        project.get(project_id)
        name = form.name.data
        description  = form.description.data
        short_name = form.description.data
        source = form.description.data
        project.add_entry(name,description,source)
        return redirect('/project/%s' % project_id)
    return render_template('entry_create.html',form=form)
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:12,代碼來源:action.py

示例15: test_project_entries

def test_project_entries():
    project = Project()
    project.find('test project entries')
    # add_entries now should have a description and name file
    # there should be a short name field, for field name
    # We should have a source
    entry_id = project.add_entry('test entries','test data','test_entries','test_entries')
    
    db = MongoModel(project='internal',collection='project')
    temp = db.query({'name':'test project entries'})
    
    assert entry_id in temp['stats'] 
開發者ID:sweemeng,項目名稱:scrapedump,代碼行數:12,代碼來源:test_project.py


注:本文中的project.model.Project類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。