def xpath(self):
        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        case = CaseXPath('')
        for index in indexes:
            case = case.index_id(index).case()
        return case.property(property)
Example #2
0
    def xpath(self):
        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_relative = property != '#owner_name'
        if use_relative:
            case = CaseXPath('')
Example #3
0
    def xpath(self):
        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_relative = property != '#owner_name'
        if use_relative:
            case = CaseXPath('')
        else:
            case = CaseXPath(u'current()')

        for index in indexes:
            case = case.index_id(index).case()

        if property == '#owner_name':
            return self.owner_name(case.property('@owner_id'))
        else:
            return case.property(property)
Example #4
0
    def _get_detail_tab_nodeset(self, module, detail, tab):
        if not tab.has_nodeset:
            return None

        if tab.nodeset:
            return tab.nodeset

        if tab.nodeset_case_type:
            nodeset = CaseTypeXpath(tab.nodeset_case_type)
            nodeset = nodeset.case(
                instance_name=detail.get_instance_name(module))
            nodeset = nodeset.select(
                CaseXPath().parent_id(),
                CaseXPath("current()").property("@case_id"))
            nodeset = nodeset.select("@status", "open")
            if tab.nodeset_filter:
                nodeset = nodeset.select_raw(
                    interpolate_xpath(tab.nodeset_filter))
            return nodeset

        return None
Example #5
0
    def xpath(self):
        if self.column.model == "product":
            return self.column.field

        parts = self.column.field.split("/")
        if self.column.model == "case":
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_relative = property != "#owner_name"
        if use_relative:
            case = CaseXPath("")
        else:
            case = CaseXPath(u"current()")

        if indexes and indexes[0] == "user":
            case = CaseXPath(UserCaseXPath().case())
        else:
            for index in indexes:
                case = case.index_id(index).case()

        if property == "#owner_name":
            return self.owner_name(case.property("@owner_id"))
        else:
            return case.property(property)
Example #6
0
    def xpath(self):
        if self.column.model == 'product':
            return self.column.field

        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_absolute = indexes or property == '#owner_name'
        if use_absolute:
            case = CaseXPath('current()')
        else:
            case = CaseXPath('')

        if indexes and indexes[0] == 'user':
            case = CaseXPath(UserCaseXPath().case())
        else:
            for index in indexes:
                case = case.index_id(index).case()

        if property == '#owner_name':
            return self.owner_name(case.property('@owner_id'))
        else:
            return case.property(property)
Example #7
0
    def xpath(self):
        if self.column.model == 'product':
            return self.column.field

        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_absolute = indexes or property == '#owner_name'
        if use_absolute:
            case = CaseXPath('current()')
Example #8
0
    @property
    def xpath(self):
        if self.column.model == 'product':
            return self.column.field

        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_absolute = indexes or property == '#owner_name'
        if use_absolute:
            case = CaseXPath('current()')
        else:
            case = CaseXPath('')

        if indexes and indexes[0] == 'user':
            case = CaseXPath(UsercaseXPath().case())
        else:
            for index in indexes:
                case = case.index_id(index).case(
                    instance_name=self.detail.instance_name)

        if property == '#owner_name':
            return self.owner_name(case.property('@owner_id'))
        else:
            return case.property(property)

    @staticmethod
    def owner_name(owner_id):
Example #9
0
    @property
    def xpath(self):
        if self.column.model == 'product':
            return self.column.field

        parts = self.column.field.split('/')
        if self.column.model == 'case':
            parts[-1] = CASE_PROPERTY_MAP.get(parts[-1], parts[-1])
        property = parts.pop()
        indexes = parts

        use_relative = property != '#owner_name'
        if use_relative:
            case = CaseXPath('')
        else:
            case = CaseXPath(u'current()')

        if indexes and indexes[0] == 'user':
            case = CaseXPath(UserCaseXPath().case())
        else:
            for index in indexes:
                case = case.index_id(index).case()

        if property == '#owner_name':
            return self.owner_name(case.property('@owner_id'))
        else:
            return case.property(property)

    @staticmethod
    def owner_name(owner_id):
        groups = XPath(u"instance('groups')/groups/group")