def perform_basic_upload_checks(xml_record):
    """ Performs tests that would provoke the bibupload task to fail with
    an exit status 1, to prevent batchupload from crashing while alarming
    the user wabout the issue
    """
    from invenio.bibupload import writing_rights_p

    errors = []
    if not writing_rights_p():
        errors.append("Error: BibUpload does not have rights to write fulltext files.")
    recs = create_records(xml_record, 1, 1)
    if recs == []:
        errors.append("Error: Cannot parse MARCXML file.")
    elif recs[0][0] is None:
        errors.append("Error: MARCXML file has wrong format: %s" % recs)
    return errors
Esempio n. 2
0
def perform_basic_upload_checks(xml_record):
    """ Performs tests that would provoke the bibupload task to fail with
    an exit status 1, to prevent batchupload from crashing while alarming
    the user wabout the issue
    """
    from invenio.bibupload import writing_rights_p

    errors = []
    if not writing_rights_p():
        errors.append("Error: BibUpload does not have rights to write fulltext files.")
    recs = create_records(xml_record, 1, 1)
    if recs == []:
        errors.append("Error: Cannot parse MARCXML file.")
    elif recs[0][0] is None:
        errors.append("Error: MARCXML file has wrong format: %s" % recs)
    return errors