class TokenBase
from django.template.smartif import TokenBase
Base class for operators and literals, mainly for debugging and for throwing syntax errors.
Ancestors (MRO)
Attribute | Type | Defined in |
---|---|---|
__dict__ |
getset_descriptor
|
django.template.smartif.TokenBase |
__weakref__ |
getset_descriptor
|
django.template.smartif.TokenBase |
Attribute | Value | Defined in |
---|---|---|
first |
None |
django.template.smartif.TokenBase |
id |
None |
django.template.smartif.TokenBase |
second |
None |
django.template.smartif.TokenBase |
value |
None |
django.template.smartif.TokenBase |
def __repr__(self)
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.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 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.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
)