示例#1
0
def test_archive():
    path = mkdtemp()
    store = FileStore(path=path)
    coll = Collection('test', store)
    coll.ingest(DATA_FILE)

    archive = open_archive('file', path=path)
    assert archive.get('test') == coll, archive.get('test')
    colls = list(archive)
    assert len(colls) == 1, colls

    rmtree(path)
示例#2
0
def test_archive():
    path = mkdtemp()
    store = FileStore(path=path)
    coll = Collection("test", store)
    coll.ingest(DATA_FILE)

    archive = open_archive("file", path=path)
    assert archive.get("test") == coll, archive.get("test")
    colls = list(archive)
    assert len(colls) == 1, colls

    rmtree(path)
示例#3
0
文件: core.py 项目: OpenOil-UG/aleph
oauth = OAuth()
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'ui'

es = Elasticsearch(app.config.get('ELASTICSEARCH_URL'))
es_index = app.config.get('ELASTICSEARCH_INDEX', app_name)

queue_name = app_name + '_q_debug'
app.config['CELERY_DEFAULT_QUEUE'] = queue_name
app.config['CELERY_QUEUES'] = (
    Queue(queue_name, Exchange(queue_name), routing_key=queue_name),
)

celery = Celery(app_name, broker=app.config['CELERY_BROKER_URL'])
celery.config_from_object(app.config)

assets = Environment(app)

archive = open_archive(app.config.get('ARCHIVE_TYPE'),
                       **app.config.get('ARCHIVE_CONFIG'))


def url_for(*a, **kw):
    try:
        kw['_external'] = True
        return _url_for(*a, **kw)
    except RuntimeError:
        return None
示例#4
0
oauth = OAuth()
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'ui'

es = Elasticsearch(app.config.get('ELASTICSEARCH_URL'))
es_index = app.config.get('ELASTICSEARCH_INDEX', app_name)

queue_name = app_name + '_q_debug'
app.config['CELERY_DEFAULT_QUEUE'] = queue_name
app.config['CELERY_QUEUES'] = (Queue(queue_name,
                                     Exchange(queue_name),
                                     routing_key=queue_name), )

celery = Celery(app_name, broker=app.config['CELERY_BROKER_URL'])
celery.config_from_object(app.config)

assets = Environment(app)

archive = open_archive(app.config.get('ARCHIVE_TYPE'),
                       **app.config.get('ARCHIVE_CONFIG'))


def url_for(*a, **kw):
    try:
        kw['_external'] = True
        return _url_for(*a, **kw)
    except RuntimeError:
        return None