Skip to content

KeyError request['context'] in AbsoluteURLNode #6

@jhagege

Description

@jhagege

I have an issue with the render method of AbsoluteURLNode.
It doesn't find the context['request'] when being rendered...
Any help would be welcomed!

File designs/templatetags/email.py line 14 in render:
request = context['request']
File django/template/context.py line 56 in getitem:
raise KeyError(key)
KeyError: 'request'

This comes from the code:

class AbsoluteUrlNode(URLNode):
    def render(self, context):
        asvar, self.asvar = self.asvar, None  # Needed to get a return value from super
        path = super(AbsoluteUrlNode, self).render(context)
        self.asvar = asvar
        request = context['request']
        absolute_url = request.build_absolute_uri(path)
        if asvar:
            context[asvar] = absolute_url
            return ''
        else:
            return absolute_url```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions