def render(self, *a, **kw): """Overrides default Wrapped.render with two additions * support for rendering API requests with proper wrapping * support for space compression of the result In adition, unlike Wrapped.render, the result is in the form of a pylons Response object with it's content set. """ res = Wrapped.render(self, *a, **kw) if is_api(): res = json_respond(res) elif self.space_compress: res = spaceCompress(res) c.response.content = res return c.response
def render(self, *a, **kw): """Overrides default Wrapped.render with two additions * support for rendering API requests with proper wrapping * support for space compression of the result In adition, unlike Wrapped.render, the result is in the form of a pylons Response object with it's content set. """ try: res = Wrapped.render(self, *a, **kw) if is_api(): res = json_respond(res) elif self.space_compress: res = spaceCompress(res) c.response.content = res except NoTemplateFound, e: # re-raise the error -- development environment if g.debug: s = sys.exc_info() raise s[1], None, s[2] # die gracefully -- production environment else: abort(404, "not found")