(xform, domain)
For id conflicts, we check if the files contain exactly the same content,
    If they do, we just log this as a dupe. If they don't, we deprecate the
    previous form and overwrite it with the new form's contents.

    :returns: A two-tuple: `(<new form>, <duplicate form or None>)`
    The new form may have a different `form_id` than `xform.form_id`.
For id conflicts, we check if the files contain exactly the same content,
    If they do, we just log this as a dupe. If they don't, we deprecate the
    previous form and overwrite it with the new form's contents.
For id conflicts we check if the files contain exactly the same content If they do we just log this as a dupe . If they don t we deprecate the previous form and overwrite it with the new form s contents .
def _handle_id_conflict(xform, domain):
    """
    For id conflicts, we check if the files contain exactly the same content,
    If they do, we just log this as a dupe. If they don't, we deprecate the
    previous form and overwrite it with the new form's contents.

    :returns: A two-tuple: `(<new form>, <duplicate form or None>)`
    The new form may have a different `form_id` than `xform.form_id`.
    """

    assert domain
    conflict_id = xform.form_id

    interface = FormProcessorInterface(domain)
    if interface.is_duplicate(conflict_id, domain):
        # It looks like a duplicate/edit in the same domain so pursue that workflow.
        logging.info('Handling duplicate doc id %s for domain %s', conflict_id, domain)
        return _handle_duplicate(xform)
    else:
        # the same form was submitted to two domains, or a form was submitted with
        # an ID that belonged to a different doc type. these are likely developers
        # manually testing or broken API users. just resubmit with a generated ID.
        interface.assign_new_id(xform)
        logging.info('Reassigned doc id from %s to %s', conflict_id, xform.form_id)
        return xform, None
def _handle_id_conflict ( xform , domain ) : assert domain conflict_id = xform . form_id interface = FormProcessorInterface ( domain ) if interface . is_duplicate ( conflict_id , domain ) : # It looks like a duplicate/edit in the same domain so pursue that workflow. logging . info ( 'Handling duplicate doc id %s for domain %s' , conflict_id , domain ) return _handle_duplicate ( xform ) else : # the same form was submitted to two domains, or a form was submitted with # an ID that belonged to a different doc type. these are likely developers # manually testing or broken API users. just resubmit with a generated ID. interface . assign_new_id ( xform ) logging . info ( 'Reassigned doc id from %s to %s' , conflict_id , xform . form_id ) return xform , None