(forms)
Return original (deprecated) forms before edited versions
Return original (deprecated) forms before edited versions
Return original ( deprecated ) forms before edited versions
def originals_first(forms):
    """
    Return original (deprecated) forms before edited versions
    """
    def get_previous_versions(form_id):
        form_ = FormAccessors.get_form(form_id)
        if getattr(form_, 'deprecated_form_id', None):
            return get_previous_versions(form_.deprecated_form_id) + [form_]
        else:
            return [form_]

    for form in forms:
        if getattr(form, 'deprecated_form_id', None):
            for previous in get_previous_versions(form.deprecated_form_id):
                yield previous
        yield form
def originals_first ( forms ) : def get_previous_versions ( form_id ) : form_ = FormAccessors . get_form ( form_id ) if getattr ( form_ , 'deprecated_form_id' , None ) : return get_previous_versions ( form_ . deprecated_form_id ) + [ form_ ] else : return [ form_ ] for form in forms : if getattr ( form , 'deprecated_form_id' , None ) : for previous in get_previous_versions ( form . deprecated_form_id ) : yield previous yield form