Using beaker cache with pyramid

2010-12-11 Thread Massimiliano Torromeo
Hi, I'm building a new website using pyramid for the first time. I have some experience with pylons and I'm finding some utilities I was using with pylons are missing in pyramid. Up till now I was able to reimplement most of what I needed, but I'm having trouble understanding what is the right way

Re: Using beaker cache with pyramid

2010-12-11 Thread Wichert Akkerman
On 2010-12-11 16:10, Massimiliano Torromeo wrote: I am already using the pyramid_beaker session factory, but there doesn't seem to exist a beaker cache factory (or a valid alternative). No factory is needed. Here is my recipe: from beaker.util import parse_cache_config_options import beake

Re: Using beaker cache with pyramid

2010-12-11 Thread Massimiliano Torromeo
I don't have a run.py. Should I put it in the main function in __init__.py? I tried my idea anyway, even if it didn't seem the correct way to do it (I learned something at least), and it works: # pyramid_beaker_cache/__init__.py from beaker.cache import CacheManager from beaker.util import parse_

Re: Using beaker cache with pyramid

2010-12-11 Thread Daniel Holth
Massimiliano, I went down the same path of looking for a per-request caching middleware that worked in the same way as the session middleware. Eventually I decided caching was not tied to a single request in the same way as a session, so I have a global cache as Wichert suggests. Daniel -- You

Re: "Twophase" branch merged to Pyramid master.

2010-12-11 Thread Chris McDonough
Sure. But such code shouldn't last for very long, because you needn't support alpha releases of Pyramid forever. - C On Fri, 2010-12-10 at 15:41 -0800, Mike Orr wrote: > On Thu, Dec 9, 2010 at 12:19 AM, Chris McDonough wrote: > > As a result, the ``pyramid.configuration`` module has been depre

Re: "Twophase" branch merged to Pyramid master.

2010-12-11 Thread Andrey Popp
Hello, it's looking just great! How do you think, can this behavior be extracted into some pattern for imperative configuration? I would like to have this in my toolchain in addition to zope.configuration. -- Andrey Popp On Thursday, December 9, 2010 at 11:19 AM, Chris McDonough wrote:

Re: "Twophase" branch merged to Pyramid master.

2010-12-11 Thread Chris McDonough
On Sat, 2010-12-11 at 23:49 +0300, Andrey Popp wrote: > Hello, > > > it's looking just great! > > > How do you think, can this behavior be extracted into some pattern for > imperative configuration? I would like to have this in my toolchain in > addition to zope.configuration. Not sure.. I hav

Re: Using beaker cache with pyramid

2010-12-11 Thread Jerry
Hi, I tried the Wichert's configuration and declared my view -- @cache.cache_region('long_term') def home_view(request): but got an error -- File '/home/virtualenv/lib/python2.6/site-packages/Beaker-1.5.4- py2.6.egg/beaker/cache.py', line 114 in cached return cache[0].get_value(cache_key, cre