コード例 #1
0
ファイル: loader.py プロジェクト: dimagi/bhoma
def get_patient(patient_id):
    """
    Loads a patient from the database.  If any conflicts are detected this
    will run through all the xforms and regenerate the patient, deleting 
    all other revisions.
    """
    resolve_conflicts(patient_id)
    return CPatient.get(patient_id)
コード例 #2
0
ファイル: conflict_resolver.py プロジェクト: dimagi/bhoma
 def resolve_conflict(line):
     try:
         change = Change(line)
         # don't bother with deleted or old documents
         if change.deleted or not change.is_current(db): 
             return log_and_abort(logging.DEBUG, "ignoring %s because it's been deleted or is old" % change)
         if conflicts.resolve_conflicts(change.id):
             logging.debug("resolved conflict for %s" % change.id)
         else:
             logging.info("no conflict found when expected in patient: %s" % change.id)
     except Exception, e:
         logging.exception("problem resolving conflict for line: %s" % line)