I did get a strange "Lexer pattern mismatch" when I was trying to use wheezy.template. After narrowing the problem down and figuring out that there wasn't a problem with my templates, I sent Andriy Kornatskyy an email and he figured out the problem.
The online documentation currently has you setup the wheezy.template engine like this:
from wheezy.html.ext.template import WhitespaceExtension
from wheezy.html.ext.template import WidgetExtension
from wheezy.html.utils import format_value
from wheezy.html.utils import html_escape
from wheezy.template.engine import Engine
from wheezy.template.ext.core import CoreExtension
from wheezy.template.loader import FileLoader
from wheezy.web.templates import WheezyTemplate
searchpath = ['content/templates-wheezy']
engine = Engine(
loader=FileLoader(searchpath),
extensions=[
CoreExtension,
WhitespaceExtension,
WidgetExtension,
])
engine.global_vars.update({
'format_value': format_value,
'h': html_escape,
})
render_template = WheezyTemplate(engine)
It should instead be like this:
engine = Engine(
loader=FileLoader(searchpath),
extensions=[
CoreExtension(),
WhitespaceExtension(),
WidgetExtension(),
])
Notice the added parentheses. That fixes the problem.
#python
#wheezy.web
#wheezy.template
