Fillできたー!
以下、自分だけわかればいい的なぐりがき。
下記のソースで、当該ページのフォームにname=”wa”とでもしておけば、そこにwawawaと出るわけでござる。
#ちょとかきなおした。
コントローラに
defaults={'wa':"wawawa"}
return render('base.html', defaults= defaults)
こっちはbase.pyあたりでいいかも。render_genshiをwrapするふりして一部書き換えてるだけ。
dist-packagesの中を書き換えるのはかなりアレなので、アプリの中で書いています。
#Wrap render_genshi
def render_genshi(template_name, extra_vars=None, cache_key=None,
cache_type=None, cache_expire=None, method='xhtml',defaults=None):
"""Render a template with Genshi
Accepts the cache options ``cache_key``, ``cache_type``, and
``cache_expire`` in addition to method which are passed to Genshi's
render function.
"""
# Create a render callable for the cache function
def render_template():
# Pull in extra vars if needed
globs = extra_vars or {}
# Second, get the globals
globs.update(pylons_globals())
# Grab a template reference
template = globs['app_globals'].genshi_loader.load(template_name)
#parserがある場合はFillする
if parser == None:
return literal(template.generate(**globs).render(method=method,
encoding=None))
else:
parser = FillingParser(defaults)
src = literal(template.generate(**globs).render(method=method,
encoding=None))
parser.feed(src)
parser.close()
return parser.text()
# ここは元のコード
# return literal(template.generate(**globs).render(method=method,
# encoding=None))
return cached_template(template_name, render_template, cache_key=cache_key,
cache_type=cache_type, cache_expire=cache_expire,
ns_options=('method'), method=method)
