I'm trying to set up a custom renderer (namely for rendering protobufs), 
but I can't figure out how to set it up. I've tried the various examples on 
how to do it, but I never get them to work. The error I get is:
>
> TemplateNotFound: Template "protobuf" not found


I've written a render function, called render_pbuf, which I'm trying to set 
in the app_cfg.py file like so (only showing relevant parts of the file):

> from coreapi.custom_extensions import render_pbuf
> base_config.renderers.append('json')
> base_config.default_renderer = 'genshi'
> base_config.renderers.append('genshi')
> base_config.render_functions['protobuf'] = render_pbuf


Then, I'm decorating a method in my root controller like this:

@expose('protobuf', content_type='application/x-protobuf')
> def test(self):
>     return {
>         'foo': 'bar',
>         'ba': 'zinga'
>     }


And a longer stack trace of the error:

File '/.../python2.7/site-packages/tg/controllers/dispatcher.py', line 124 
> in _perform_call
>   r = self._call(func, params, remainder=remainder)
> File '/.../python2.7/site-packages/tg/controllers/decoratedcontroller.py', 
> line 145 in _call
>   response = self._render_response(controller, output)
> File '/.../python2.7/site-packages/tg/controllers/decoratedcontroller.py', 
> line 318 in _render_response
>   template_name=template_name, **render_params)
> File '/.../python2.7/site-packages/tg/render.py', line 183 in render
>   kwargs['result'] = render_function(template_name, tg_vars, **kwargs)
> File '/.../python2.7/site-packages/tg/render.py', line 404 in __call__
>   ns_options=('doctype', 'method'), **kwargs)
> File '/.../python2.7/site-packages/tg/render.py', line 248 in 
> cached_template
>   return render_func()
> File '/.../python2.7/site-packages/tg/render.py', line 399 in 
> render_template
>   template = self.load_template(template_name)
> File '/.../python2.7/site-packages/tg/dottednames/genshi_lookup.py', line 
> 29 in load
>   relative_to=relative_to, cls=cls, encoding=encoding)
> File 'build/bdist.macosx-10.7-x86_64/egg/genshi/template/loader.py', line 
> 246 in load
> TemplateNotFound: Template "protobuf" not found



Worth noting is that the code in the render_pbuf function never runs, I've 
added 10/0 as the first line just to make it crash if it does run, but it 
never does, so the problem lies elsewhere.

Does anyone have any idea on what I'm doing wrong?

Best regards,
Atra Azami

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to