So I guess no one is actually using memcached for storing sessions ?
Or of you do, do you define your own memcached interface instead of
the
Beaker memcached interface for session storage ?

One possibility is to use the namespace_class parameter in the config
file:

beaker.session.namespace_class = my_class

But that config value is passed as a string to Session.__init__ in the
beaker.session module, instead of a class object, so the above setting
wouldn't work. To fix that you can use the following patch for Beaker:

import beaker.session
import re

beaker.session.Session._org_init = beaker.session.Session.__init__

def _user_session(*args, **kwargs):
    if kwargs.has_key('namespace_class'):
        ns_class_name = kwargs['namespace_class']
        try:
            r=re.search(r'^(.*)\.\w*$', ns_class_name)
            exec 'import '+ r.group(1)
            ns_class = eval(ns_class_name)
        except:
            ns_class = None

        kwargs['namespace_class'] = ns_class

    beaker.session.Session._org_init(*args, **kwargs)

beaker.session.Session.__init__ = _user_session

With the above patch you should be able to specify your own class in
the config file (e.g. development.ini) to handle session storage.

Stay tuned for the actual definition of such a class to handle storing
sessions in memcached correctly.

On Dec 30, 12:50 am, Tycon <[email protected]> wrote:
> Cause if I use this setting in development.ini :
>
> beaker.session.type = ext:memcached
> beaker.session.url = 127.0.0.1:11211
>
> then if I try to access the session global, I get this error:
>
> NotImplementedError: Memcache caching does not support iteration of
> all cache keys
>
> This is raised from Module beaker.ext.memcached:76 in keys().
>
> Am I doing something wrong, or is using memcahced store for sessions
> messed up ??
>
> Everything works if I don't set the "beaker.session.type" in
> development.ini, cause then it's using the filesystem to store
> sessions.  Funny that when using the filesystem it's pickling the
> session object and storing it in a file, but when trying to use
> memcached, it's actually trying to store each session attribute as a
> separate record in memcached. And the code in beaker.ext.memcached
> seems to actually do a flush_all of memcached when the session is to
> be removed !!!!! hahahahaha -  that means that it will flush
> everything else from memcached, unless it expects memcahced to be
> dedicated to only one session's data (at a time) ????
>
> Not to mention the expiration memchanism also doesnt seem to work, as
> any setting I tried it always called memcached with no expiration
> specified. Not that it matters cause of the above error nothing works
> anyway.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to