invenio_migrator/legacy/bibdocfile.py
def dump_bibdoc(recid, from_date, **kwargs):
    """Dump all BibDoc metadata.

    :param docid: BibDoc ID
    :param from_date: Dump only BibDoc revisions newer than this date.

    :returns: List of version of the BibDoc formatted as a dict
    """
    BibRecDocs, BibDoc = _import_bibdoc()

    bibdocfile_dump = []

    date = datetime.datetime.strptime(from_date, '%Y-%m-%d %H:%M:%S')
    for bibdoc in BibRecDocs(recid).list_bibdocs():
        for version in bibdoc.list_versions():
            bibdoc_version = bibdoc.list_version_files(version)
            for f in bibdoc_version:
                if f.is_icon() or f.md < date:
                    # Don't care about icons
                    # Don't care about files not modified since from_date
                    continue
                bibdocfile_dump.append(dict(
                    bibdocid=f.get_bibdocid(),
                    checksum=f.get_checksum(),
                    comment=f.get_comment(),
                    copyright=(
                        f.get_copyright() if hasattr(f, 'get_copyright')
                        else None),
                    creation_date=datetime_toutc(f.cd).isoformat(),
                    description=f.get_description(),
                    encoding=f.encoding,
                    etag=f.etag,
                    flags=f.flags,
                    format=f.get_format(),
                    full_name=f.get_full_name(),
                    full_path=f.get_full_path(),
                    hidden=f.hidden,
                    license=(
                        f.get_license()if hasattr(f, 'get_license') else None),
                    modification_date=datetime_toutc(f.md).isoformat(),
                    name=f.get_name(),
                    mime=f.mime,
                    path=f.get_path(),
                    recid=f.get_recid(),
                    recids_doctype=f.recids_doctypes,
                    size=f.get_size(),
                    status=f.get_status(),
                    subformat=f.get_subformat(),
                    superformat=f.get_superformat(),
                    type=f.get_type(),
                    url=f.get_url(),
                    version=f.get_version(),
                ))

    return bibdocfile_dump
def dump_bibdoc(recid, from_date, **kwargs):
    """Dump all BibDoc metadata.

    :param docid: BibDoc ID
    :param from_date: Dump only BibDoc revisions newer than this date.

    :returns: List of version of the BibDoc formatted as a dict
    """
    BibRecDocs, BibDoc = _import_bibdoc()

    bibdocfile_dump = []

    date = datetime.datetime.strptime(from_date, '%Y-%m-%d %H:%M:%S')
    for bibdoc in BibRecDocs(recid).list_bibdocs():
        for version in bibdoc.list_versions():
            bibdoc_version = bibdoc.list_version_files(version)
            for f in bibdoc_version:
                if f.is_icon() or f.md < date:
                    # Don't care about icons
                    # Don't care about files not modified since from_date
                    continue
                bibdocfile_dump.append(dict(
                    bibdocid=f.get_bibdocid(),
                    checksum=f.get_checksum(),
                    comment=f.get_comment(),
                    copyright=(
                        f.get_copyright() if hasattr(f, 'get_copyright')
                        else None),
                    creation_date=datetime_toutc(f.cd).isoformat(),
                    description=f.get_description(),
                    encoding=f.encoding,
                    etag=f.etag,
                    flags=f.flags,
                    format=f.get_format(),
                    full_name=f.get_full_name(),
                    full_path=f.get_full_path(),
                    hidden=f.hidden,
                    license=(
                        f.get_license()if hasattr(f, 'get_license') else None),
                    modification_date=datetime_toutc(f.md).isoformat(),
                    name=f.get_name(),
                    mime=f.mime,
                    path=f.get_path(),
                    recid=f.get_recid(),
                    recids_doctype=f.recids_doctypes,
                    size=f.get_size(),
                    status=f.get_status(),
                    subformat=f.get_subformat(),
                    superformat=f.get_superformat(),
                    type=f.get_type(),
                    url=f.get_url(),
                    version=f.get_version(),
                ))

    return bibdocfile_dump
Dump all BibDoc metadata.

    :param docid: BibDoc ID
    :param from_date: Dump only BibDoc revisions newer than this date.

    :returns: List of version of the BibDoc formatted as a dict