Hi,<br><br>I followed the tutorial in <a href="http://grok.zope.org/documentation/how-to/plugging-in-new-template-languages">http://grok.zope.org/documentation/how-to/plugging-in-new-template-languages</a> and I'm using a combination of Jinja + Yaml + simplejson<br>
to be able to render JSON format from grok.View classes. <br><br>Basically I have something like this:<br><br>from jinja2 import Template<br>import yaml, simplejson, grok, os<br>from grokcore.view.components import GrokTemplate<br>
from grokcore.view.interfaces import ITemplate, ITemplateFileFactory<br><br>class JSONTemplate(GrokTemplate):<br> grok.implements(ITemplate)<br><br> def setFromString(self, string):<br> self._template = Template(string)<br>
<br> def setFromFilename(self, filename, _prefix=None):<br> file = open(os.path.join(_prefix, filename))<br> self._template = Template(file.read())<br><br> def render(self, view):<br> jinja_render = self._template.render(**self.getNamespace(view))<br>
yaml_loader = yaml.load(jinja_render)<br> return simplejson.dumps(yaml_loader)<br><br><br>I'm doing this because I want to build an application that only use JSON and some JavaScript framework on the client side (extjs by now). And I didn't like the way I should use grok.JSON (too much classes and methods).<br>
<br>The question is: is there any way to reload the plugged templates without restart zope? like grok does with default ZPT<br><br>thanks in advance.<br clear="all"><br>-- <br>Santiago Videla<br><a href="http://www.revolucionesweb.com.ar">www.revolucionesweb.com.ar</a><br>
<a href="http://www.linkedin.com/in/svidela">http://www.linkedin.com/in/svidela</a><br><br>Sigue la mata dando de que hablar siempre abajo y a la izquierda donde el pensamiento que se hace corazón resplandece con la palabra sencilla y humilde que l@s tod@s somos.<br>