Example #1
0
def service_switcher(context):
    rights = resolve_variable('rights', context)
    # filtering services with permissions
    rights = filter(lambda x: len(x.get('properties', []))>0, rights)
    srvs = [x.get('service_type') for x in rights]
    # filtering supported services
    sup_srvs = filter(lambda x: x in srvs, SUPPORTED_SERVICES)
    return {'services': sup_srvs, 'cur_service': context['cur_service'],
        'cur_lang': context['cur_lang']}
Example #2
0
 def render(self, context):
     locale = resolve_variable(self.locale, context)
     if utils.supported_language(locale) is None:
         raise ValueError("locale not in settings.LANGUAGES: %s" % locale)
     path = self.urlnode.render(context)
     if self.urlnode.asvar:
         self.urlnode.render(context)
         context[self.urlnode.asvar] = chlocale(context[self.urlnode.asvar],
                                                locale)
         return ''
     else:
         return chlocale(path, locale)
Example #3
0
 def render(self, context):
     locale = resolve_variable(self.locale, context)
     if utils.supported_language(locale) is None:
         raise ValueError("locale not in settings.LANGUAGES: %s" % locale)
     path = self.urlnode.render(context)
     if self.urlnode.asvar:
         self.urlnode.render(context)
         context[self.urlnode.asvar] = chlocale(context[self.urlnode.asvar],
                 locale)
         return ''
     else:
         return chlocale(path, locale)
Example #4
0
    def render(self, context):
        payment_info = resolve_variable(self._payment_info_reference, context)

        container_style = ""
        if self._options.get("no_margins", False):
            container_style += "margin: 0em; "
        container_width = self._options.get("width", None)
        if container_width:
            container_style += "width: " + container_width + "; "

        template = get_template("custom-tags/payment-details.html")
        context.update({
            "payment_info": payment_info,
            "container_style": container_style.strip()
        })
        output = template.render(context)
        context.pop()

        return output
    def render(self, context):
        payment_info = resolve_variable(self._payment_info_reference, context)

        container_style = ""
        if self._options.get("no_margins", False):
            container_style += "margin: 0em; "
        container_width = self._options.get("width", None)
        if container_width:
            container_style += "width: " + container_width + "; "

        template = get_template("custom-tags/payment-details.html")
        context.update({
            "payment_info": payment_info,
            "container_style": container_style.strip()
        })
        output = template.render(context)
        context.pop()

        return output