Example #1
0
    def template(self):
        template = sx.Template(
            text=sx.Text(xpath_function=self.xpath_function),
            form=self.template_form,
            width=self.template_width,
        )

        if self.column.useXpathExpression:
            xpath = sx.CalculatedPropertyXpath(function=self.xpath)
            if re.search(r'\$lang', self.xpath):
                xpath.variables.node.append(
                    sx.CalculatedPropertyXpathVariable(
                        name=u'lang',
                        locale_id=self.id_strings.current_language()
                    ).node
                )
            xpath_variable = sx.XpathVariable(name=u'calculated_property', xpath=xpath)
            template.text.xpath.variables.node.append(xpath_variable.node)

        if self.variables:
            for key, value in sorted(self.variables.items()):
                template.text.xpath.variables.node.append(
                    sx.XpathVariable(name=key, locale_id=value).node
                )

        return template
Example #2
0
    def template(self):
        template = sx.Template(
            text=sx.Text(xpath_function=self.xpath_function),
            form=self.template_form,
            width=self.template_width,
        )
        if self.variables:
            for key, value in sorted(self.variables.items()):
                template.text.xpath.variables.node.append(
                    sx.XpathVariable(name=key, locale_id=value).node)

        return template
Example #3
0
 def hidden_template(self):
     return sx.Template(
         text=sx.Text(xpath_function=self.sort_xpath_function),
         width=0,
     )