Пример #1
0
def create_cache(recid,
                 uid,
                 record='',
                 cache_dirty=False,
                 pending_changes=[],
                 disabled_hp_changes={},
                 undo_list=[],
                 redo_list=[]):
    """Create a BibEdit cache file, and return revision and record. This will
    overwrite any existing cache the user has for this record.
    datetime.

    """
    if not record:
        record = get_bibrecord(recid)
        if not record:
            return (None, None)

    record_revision = get_record_last_modification_date(recid)
    if record_revision is None:
        record_revision = datetime.now().timetuple()

    assert_undo_redo_lists_correctness(undo_list, redo_list)

    # Order subfields alphabetically after loading the record
    record_order_subfields(record)

    data = [
        cache_dirty, record_revision, record, pending_changes,
        disabled_hp_changes, undo_list, redo_list
    ]
    update_cache(recid, uid, data)
    return record_revision, record
Пример #2
0
def create_cache(
    recid, uid, record="", cache_dirty=False, pending_changes=[], disabled_hp_changes={}, undo_list=[], redo_list=[]
):
    """Create a BibEdit cache file, and return revision and record. This will
    overwrite any existing cache the user has for this record.
    datetime.

    """
    if not record:
        record = get_bibrecord(recid)
        if not record:
            return (None, None)

    record_revision = get_record_last_modification_date(recid)
    if record_revision is None:
        record_revision = datetime.now().timetuple()

    assert_undo_redo_lists_correctness(undo_list, redo_list)

    # Order subfields alphabetically after loading the record
    record_order_subfields(record)

    data = [cache_dirty, record_revision, record, pending_changes, disabled_hp_changes, undo_list, redo_list]
    update_cache(recid, uid, data)
    return record_revision, record
Пример #3
0
def update_cache_contents(
    recid, uid, record_revision, record, pending_changes, disabled_hp_changes, undo_list, redo_list
):
    """Save updates to the record in BibEdit cache. Return file modificaton
    time.

    """
    data = [True, record_revision, record, pending_changes, disabled_hp_changes, undo_list, redo_list]
    update_cache(recid, uid, data)
    return get_cache_mtime(recid, uid)
Пример #4
0
def update_cache_contents(recid, uid, record_revision, record, pending_changes,
                          disabled_hp_changes, undo_list, redo_list):
    """Save updates to the record in BibEdit cache. Return file modificaton
    time.

    """
    data = [True, record_revision, record, pending_changes,
            disabled_hp_changes, undo_list, redo_list]
    update_cache(recid, uid, data)
    return get_cache_mtime(recid, uid)