From 92244526496090c38587169c62cab80423e1af32 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 26 Feb 2007 22:20:47 +0100 Subject: [PATCH] [svn] removed some code that is not used any more in jinja --HG-- branch : trunk --- jinja/ast.py | 108 ------------------------------------------- jinja/defaults.py | 6 +-- jinja/environment.py | 12 +---- 3 files changed, 2 insertions(+), 124 deletions(-) delete mode 100644 jinja/ast.py diff --git a/jinja/ast.py b/jinja/ast.py deleted file mode 100644 index 88f18a2..0000000 --- a/jinja/ast.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -""" - jinja.ast - ~~~~~~~~~ - - Advance Syntax Tree for jinja. - - :copyright: 2006 by Armin Ronacher. - :license: BSD, see LICENSE for more details. -""" - -class Node(object): - """ - Baseclass of all nodes. For instance checking. - """ - __slots__ = () - - def __init__(self): - raise TypeError('cannot create %r instances' % - self.__class__.__name__) - - -class Expression(list, Node): - """ - Node that helds childnodes. Normally just used temporary. - """ - __slots__ = () - - def __init__(self, *args, **kwargs): - super(Expression, self).__init__(*args, **kwargs) - - def __repr__(self): - return 'Expression(%s)' % list.__repr__(self) - - -class Comment(Node): - """ - Node that helds a comment. We keep comments in the data - if some translator wants to forward it into the generated - code (for example the python translator). - """ - __slots__ = ('pos', 'comment',) - - def __init__(self, pos, comment): - self.pos = pos - self.comment = comment - - def __repr__(self): - return 'Comment(%r, %r)' % (self.pos, self.comment) - - -class Page(Node): - """ - Node that helds all root nodes. - """ - __slots__ = ('filename', 'nodes') - - def __init__(self, filename, nodes): - self.filename = filename - self.nodes = nodes - - def __repr__(self): - return 'Page(%r, %r)' % ( - self.filename, - self.nodes - ) - - -class Variable(Node): - """ - Node for variables - """ - __slots__ = ('pos', 'expression') - - def __init__(self, pos, expression): - self.pos = pos - self.expression = expression - - def __repr__(self): - return 'Variable(%r)' % self.expression - - -class Data(Node): - """ - Node for data outside of tags. - """ - __slots__ = ('pos', 'data') - - def __init__(self, pos, data): - self.pos = pos - self.data = data - - def __repr__(self): - return 'Data(%d, %r)' % (self.pos, self.data) - - -class Name(Node): - """ - Node for names. - """ - __slots__ = ('pos', 'data') - - def __init__(self, pos, data): - self.pos = pos - self.data = data - - def __repr__(self): - return 'Name(%d, %r)' % (self.pos, self.data) diff --git a/jinja/defaults.py b/jinja/defaults.py index 4a2d6bb..0d16b2f 100644 --- a/jinja/defaults.py +++ b/jinja/defaults.py @@ -8,8 +8,4 @@ :copyright: 2006 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ - - -DEFAULT_TAGS = {} - -DEFAULT_FILTERS = {} +from jinja.filters import FILTERS as DEFAULT_FILTERS diff --git a/jinja/environment.py b/jinja/environment.py index 1f1a62c..32659c6 100644 --- a/jinja/environment.py +++ b/jinja/environment.py @@ -11,7 +11,7 @@ from jinja.lexer import Lexer from jinja.parser import Parser from jinja.exceptions import TagNotFound, FilterNotFound -from jinja.defaults import DEFAULT_TAGS, DEFAULT_FILTERS +from jinja.defaults import DEFAULT_FILTERS class Environment(object): @@ -44,7 +44,6 @@ class Environment(object): self.template_charset = template_charset self.charset = charset self.loader = loader - self.tags = tags or DEFAULT_TAGS.copy() self.filters = filters or DEFAULT_FILTERS.copy() # create lexer @@ -55,15 +54,6 @@ class Environment(object): parser = Parser(self, source) return parser.parse_page() - def get_tag(self, name): - """ - Return the tag for a specific name. Raise a `TagNotFound` exception - if a tag with this name is not registered. - """ - if name not in self._tags: - raise TagNotFound(name) - return self._tags[name] - def get_filter(self, name): """ Return the filter for a given name. Raise a `FilterNotFound` exception -- 2.26.2