(self, case_type=None)
return all(check_parents(parent.tag) for parent in reg_action.case_indices)
Defined as form that opens a single case. If the case is a sub-case then
        the form is only allowed to load parent cases (and any auto-selected cases).
Defined as form that opens a single case. If the case is a sub-case then
        the form is only allowed to load parent cases (and any auto-selected cases).
Defined as form that opens a single case . If the case is a sub - case then the form is only allowed to load parent cases ( and any auto - selected cases ) .
def is_registration_form(self, case_type=None):
        """
        Defined as form that opens a single case. If the case is a sub-case then
        the form is only allowed to load parent cases (and any auto-selected cases).
        """
        reg_actions = self.get_registration_actions(case_type)
        if len(reg_actions) != 1:
            return False

        load_actions = [action for action in self.actions.load_update_cases if not action.auto_select]
        if not load_actions:
            return True

        reg_action = reg_actions[0]
        if not reg_action.case_indices:
            return False

        actions_by_tag = deepcopy(self.actions.actions_meta_by_tag)
        actions_by_tag.pop(reg_action.case_tag)

        def check_parents(tag):
            """Recursively check parent actions to ensure that all actions for this form are
            either parents of the registration action or else auto-select actions.
            """
            if not tag:
                return not actions_by_tag or all(
                    getattr(a['action'], 'auto_select', False) for a in actions_by_tag.values()
                )

            try:
                parent = actions_by_tag.pop(tag)
            except KeyError:
                return False

            return all(check_parents(p.tag) for p in parent['action'].case_indices)

        return all(check_parents(parent.tag) for parent in reg_action.case_indices)
def is_registration_form ( self , case_type = None ) : reg_actions = self . get_registration_actions ( case_type ) if len ( reg_actions ) != 1 : return False load_actions = [ action for action in self . actions . load_update_cases if not action . auto_select ] if not load_actions : return True reg_action = reg_actions [ 0 ] if not reg_action . case_indices : return False actions_by_tag = deepcopy ( self . actions . actions_meta_by_tag ) actions_by_tag . pop ( reg_action . case_tag ) def check_parents ( tag ) : """Recursively check parent actions to ensure that all actions for this form are
            either parents of the registration action or else auto-select actions.
            """ if not tag : return not actions_by_tag or all ( getattr ( a [ 'action' ] , 'auto_select' , False ) for a in actions_by_tag . values ( ) ) try : parent = actions_by_tag . pop ( tag ) except KeyError : return False return all ( check_parents ( p . tag ) for p in parent [ 'action' ] . case_indices ) return all ( check_parents ( parent . tag ) for parent in reg_action . case_indices )