Uhm, it's pretty long to explain the reason :) I can make it short by telling you that before version 2.3, TurboGears resolved the expositions at controller import time. This lead to the fact that if for any reason the controller is imported before the "protobuf" renderer was registered in base_config.renderers when the exposition was resolved, "protobuf" was not recognized as an engine and so it was considered a template of the default engine.
By using the "protobuf:" notation, you make clear to TurboGears that you are actually refer to it as an engine and disable the automatic decision of considering it as an engine name or template name. On Thu, Mar 13, 2014 at 9:10 AM, Atra Azami <[email protected]> wrote: > I tried it, and it worked - thanks! > > However I'm still curious - why does it still work in the root controller > only, even when not using the ':' char? > > > On Wednesday, March 12, 2014 5:21:37 PM UTC+1, Alessandro Molina wrote: > >> 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. > -- 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.

