if you @expose something without specifying an engine, it is considered to
be a template path for the default renderer.
so if you do @expose('protobuf') what you are actually doing is
@expose('genshi:protobuf') which leads to the TemplateNotFound error as
Genshi is unable to load a "protobuf.html" file.

What you are looking for is @expose('protobuf:') which exposes the engine
without a template (as your protobuf engine doesn't have any template).


On Wed, Mar 12, 2014 at 4:24 PM, Atra Azami <[email protected]> wrote:

> I have a strange problem with trying to expose a custom renderer (named
> 'protobuf').
>
> In my root controller (controllers/root.py) just exposing the 'protobuf'
> renderer works as intended. However, as soon as I try to expose it in any
> other controller, I get an error: TemplateNotFound: Template "protobuf"
> not found.
>
> I've tried commenting out *everything* in the root controller, except for
> the class definition and a method which exposes the protobuf renderer, and
> I tried doing the same thing in another controller (commented out
> everything and exposed 1 method) - and I still get the error, so the error
> shouldn't be due to any import errors or such on my side at least.
>
> Does anyone have a clue as to what could be causing this? I'm running TG
> 2.2.2.
>
> This is an excerpt of what my app_cfg.py looks like:
>
> from coreapi.config.custom_extensions import render_pbuf
>>
>
>
> def setup_protobuf_renderer():
>>     base_config.render_functions.protobuf = render_pbuf
>>
>
>
> base_config.setup_protobuf_renderer = setup_protobuf_renderer
>> base_config.renderers.append('protobuf')
>
>
>
>
> And this is how my controllers look like (both the root, and the other
> controllers I've tested with after removing everything else):
>
> from tg import expose
>
> from coreapi.controllers import CoreAPIBaseController
>
>
>
> class RootController(CoreAPIBaseController):
>>     @expose('protobuf', content_type='application/x-protobuf')
>>     def test(self):
>>         # does stuff
>>
>
> CoreAPIBaseController basically just wraps the normal TG BaseController
> class so it doesn't do anything other than adding a method that all
> controller should have access to.
>
>
> BR,
> Atra
>
>  --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to