Exemplo n.º 1
0
    def get_properties(self, case_type, already_visited=(),
                       include_shared_properties=True):
        if case_type in already_visited:
            return ()

        get_properties_recursive = functools.partial(
            self.get_properties,
            already_visited=already_visited + (case_type,)
        )

        case_properties = set(self.defaults)

        for m_case_type, form in self.forms_info:
            case_properties.update(self.get_case_updates(form, case_type))

        parent_types, contributed_properties = \
            self.get_parent_types_and_contributed_properties(case_type)
        case_properties.update(contributed_properties)
        for parent_type in parent_types:
            for property in get_properties_recursive(parent_type[0]):
                case_properties.add('%s/%s' % (parent_type[1], property))
        if self.app.case_sharing and include_shared_properties:
            from corehq.apps.app_manager.models import Application
            for app in Application.by_domain(self.app.domain):
                if app.case_sharing:
                    case_properties.update(
                        get_case_properties(
                            app, [case_type], include_shared_properties=False
                        ).get(case_type, [])
                    )

        return case_properties
Exemplo n.º 2
0
 def obj_get_list(self, bundle, domain, **kwargs):
     return Application.by_domain(domain)