Exemple #1
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)
Exemple #2
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)
    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)