def del_person_papers_needs_manual_review(pid, bibrec): ''' Deletes from the set of papers awaiting for manual review for a person @param pid: personid, int @param bibrec: the bibrec, int ''' dbinter.del_person_data(person_id=pid, tag='paper_needs_bibref_manual_confirm', value=str(bibrec))
def set_processed_external_recids(pid, recid_list_str): ''' Set processed external recids @param pid: pid @param recid_list_str: str ''' dbinter.del_person_data(person_id=pid, tag='processed_external_recids') dbinter.set_person_data(pid, "processed_external_recids", recid_list_str)
def assign_uid_to_person(uid, pid, create_new_pid=False, force=False): ''' Assigns a userid to a person, counterchecknig with get_personid_from_uid. If uid has already other person returns other person. If create_new_pid and the pid is -1 creates a new person. If force, deletes any reference to that uid from the tables and assigns to pid, if pid wrong (less then zero) returns -1. @param uid: user id, int @param pid: person id, int @param create_new_pid: bool @param force, bool ''' if force and pid >= 0: dbinter.del_person_data(tag='uid', value=str(uid)) dbinter.set_person_data(pid, 'uid', str(uid)) return pid elif force and pid < 0: return -1 current = dbinter.get_personid_from_uid(((uid,),)) if current[1]: return current[0][0] else: if pid >= 0: cuid = dbinter.get_person_data(pid, 'uid') if len(cuid) > 0: if str(cuid[0][1]) == str(uid): return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1 else: dbinter.set_person_data(pid, 'uid', str(uid)) return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1
def assign_uid_to_person(uid, pid, create_new_pid=False, force=False): ''' Assigns a userid to a person, counterchecknig with get_personid_from_uid. If uid has already other person returns other person. If create_new_pid and the pid is -1 creates a new person. If force, deletes any reference to that uid from the tables and assigns to pid, if pid wrong (less then zero) returns -1. @param uid: user id, int @param pid: person id, int @param create_new_pid: bool @param force, bool ''' if force and pid >= 0: dbinter.del_person_data(tag='uid', value=str(uid)) dbinter.set_person_data(pid, 'uid', str(uid)) return pid elif force and pid < 0: return -1 current = dbinter.get_personid_from_uid(((uid, ), )) if current[1]: return current[0][0] else: if pid >= 0: cuid = dbinter.get_person_data(pid, 'uid') if len(cuid) > 0: if str(cuid[0][1]) == str(uid): return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1 else: dbinter.set_person_data(pid, 'uid', str(uid)) return pid else: if create_new_pid: dbinter.create_new_person_from_uid(uid) else: return -1