Beispiel #1
0
def create_delete(message):
    """creates and deletes the record"""
    diff = message.getParam('diff')
    if diff:
        diff = int(str(diff))
    else:
        diff = 5 # 5 secs older
    recid = bibupload.create_new_record()
    #rec_id = bibupload.create_new_record()
    #expected_rec_id = dbquery.run_sql("SELECT MAX(id) FROM bibrec")[0][0] + 1
    xml_to_delete = """
        <record>
        <datafield tag="100" ind1=" " ind2=" ">
         <subfield code="a">Test, Jane</subfield>
         <subfield code="u">Test Institute</subfield>
        </datafield>
        <datafield tag="100" ind1="4" ind2="7">
         <subfield code="a">Test, Johnson</subfield>
         <subfield code="u">Test University</subfield>
        </datafield>
        <datafield tag="980" ind1="" ind2="">
         <subfield code="c">DELETED</subfield>
        </datafield>
        </record>
        """ 
    
    recs = bibupload.xml_marc_to_records(xml_to_delete)
    ret = bibupload.bibupload(recs[0], opt_mode='insert')
    recid = ret[1]
    message.setResults(Integer(recid))
    change_date(recid, diff=diff)
def create_record(message):
    """creates record"""
    diff = message.getParam("diff")
    if diff:
        diff = int(str(diff))
    else:
        diff = 5  # 5 secs older
    recid = bibupload.create_new_record()
    message.setResults(Integer(int(recid)))
    # dbquery.run_sql("UPDATE bibrec SET modification_date=NOW() + %s, creation_date=NOW() + %s WHERE id=%s" % (diff, diff,recid))
    change_date(recid, diff=diff, cdiff=diff)
Beispiel #3
0
def create_record(message):
    """creates record"""
    
    diff = message.getParam('diff')
    if diff:
        diff = int(str(diff))
    else:
        diff = 5 # 5 secs older
    recid = bibupload.create_new_record()
    message.setResults(Integer(int(recid)))
    #dbquery.run_sql("UPDATE bibrec SET modification_date=NOW() + %s, creation_date=NOW() + %s WHERE id=%s" % (diff, diff,recid))
    
    data = message.getParam('data')
    if data:
        record = search_engine.get_record(recid)
        for field_data in str(data).split("|"):
            points = field_data.split(":", 3)
            bibrecord.record_add_field(record, points[0], subfields=[(points[1], points[2])])
        ret = bibupload.bibupload(record, opt_mode='replace')
    
    change_date(recid, diff=diff, cdiff=diff)