On 03/13/2015 03:32 PM, Jonathan Vanasco wrote:
the `view_config` issue I encountered is that there is essentially no native way to return HTML. view_config supports most other types (templating engines, json, plaintext) but not HTML. that's very awkward to me.
You mean renderers specified via view_config(renderer=...). Like I said, I don't think this is the right place to implement caching.
A view_config(mapper=..) or view_config(decorator=...) might be though. decorator= is probably the more likely place, I guess, because decorators set up this way will call downstream functions that are guaranteed to return an actual response object instead of possibly receiving something that is meant to be rendered by a renderer like a view mapper might.
-- a lot frameworks have application-level page/view/response caches. the more simple implementations cache the html or html+headers, the more robust ones selectively cache header elements.
OK. I hadn't been looking.
Pylons has a `@beaker_cache` decorator for controller actions (views). http://pylons-webframework.readthedocs.org/en/latest/caching.html Django has a `@cache_page` for views https://docs.djangoproject.com/en/1.7/topics/cache/ Turbogears has a `@cached` http://turbogears.readthedocs.org/en/latest/turbogears/caching.html Cherrypy does the page caching at an application level in the config files. i don't think you can enable/disble for views, just the entire app.
Flask supports a Caching Decorator "pattern" that works on views. http://flask.pocoo.org/docs/0.10/patterns/viewdecorators/#caching-decorator
The Flask example is an example of caching a response that could be used almost directly in Pyramid (via view_config(decorator=..)).
- C
-- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
-- You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
