class Literal

from django.template.smartif import Literal
A basic self-resolvable object similar to a Django template variable.

Ancestors (MRO)

  1. builtins.object
  2. django.template.smartif.TokenBase
  3. django.template.smartif.Literal
AttributeTypeDefined in
AttributeValueDefined in
def __init__(self, value)
django.template.smartif.Literal
Initialize self.  See help(type(self)) for accurate signature.
    def __init__(self, value):
        self.value = value
def __repr__(self)
django.template.smartif.Literal
django.template.smartif.Literal
Return repr(self).
    def __repr__(self):
        return "(%s %r)" % (self.id, self.value)
django.template.smartif.TokenBase
Return repr(self).
    def __repr__(self):
        out = [str(x) for x in [self.id, self.first, self.second] if x is not None]
        return "(" + " ".join(out) + ")"
def display(self)
django.template.smartif.Literal
django.template.smartif.Literal
Return what to display in error messages for this node
    def display(self):
        return repr(self.value)
django.template.smartif.TokenBase
Return what to display in error messages for this node
    def display(self):
        """
        Return what to display in error messages for this node
        """
        return self.id
def eval(self, context)
django.template.smartif.Literal
    def eval(self, context):
        return self.value
def led(self, left, parser)
django.template.smartif.TokenBase
    def led(self, left, parser):
        # Left denotation - called in infix context
        raise parser.error_class(
            "Not expecting '%s' as infix operator in if tag." % self.id
        )
def nud(self, parser)
django.template.smartif.Literal
django.template.smartif.Literal
    def nud(self, parser):
        return self
django.template.smartif.TokenBase
    def nud(self, parser):
        # Null denotation - called in prefix context
        raise parser.error_class(
            "Not expecting '%s' in this position in if tag." % self.id
        )