Example #1
0
File: pages.py Project: cmak/reddit
 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
Example #2
0
File: pages.py Project: vin/reddit
 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")
Example #3
0
 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")
Example #4
0
 def render(self, *a, **kw):
     res = Wrapped.render(self, *a, **kw)
     res = spaceCompress(res)
     return res
Example #5
0
 def render(self, *a, **kw):
     res = Wrapped.render(self, *a, **kw)
     res = spaceCompress(res)
     return res