Ejemplo n.º 1
0
def execute(ctx):
    """Forces document ingestion.

    :param object ctx: Document processing context information.

    """
    if not ctx.force:
        return

    doc = dao.get_document(ctx.doc.meta.id, ctx.doc.meta.version)
    if doc:
        dao.delete_document(doc.id)
        session.commit()
Ejemplo n.º 2
0
def _main(project_code, source):
    """Main entry point.

    """
    if source == "*" or len(source) == 0:
    	source = None

    session.start(config.db)
    try:
        _execute(project_code, source)
    except Exception as err:
        session.rollback()
        logger.log_db_error(err)
    else:
        session.commit()
    finally:
        session.end()
Ejemplo n.º 3
0
def _main(project_code, source):
    """Main entry point.

    """
    if source == "*" or len(source) == 0:
        source = None

    session.start(config.db)
    try:
        _execute(project_code, source)
    except Exception as err:
        session.rollback()
        logger.log_db_error(err)
    else:
        session.commit()
    finally:
        session.end()
Ejemplo n.º 4
0
def execute(ctx):
    """Creates document index.

    :param object ctx: Document processing context information.

    """
    # Get related documents (sorted by version).
    documents = dao.get_document(ctx.primary.uid,
                                 constants.DOCUMENT_VERSION_ALL,
                                 ctx.primary.project)

    # Uodate flag accordingly.
    for index, document in enumerate(documents):
        document.is_latest = (index == 0)

    # Commit changes.
    session.commit()