Hi,

today I encountered a very strange problem with request methods.

<--- code --->

cache = {'agents': set(),
         'time': 0.0}
cache_lock = Lock()


def in_agent_cache(request):
    with cache_lock:
        return request.user_agent in cache['agents']

<--- end code --->

If I call the method directly, everything works fine.

if I register the method as a request method and call it via request.in_agent_cache() the dict is always the default version, the set empty and time .

If I move the dict and lock to another file and import it. Everything works even as a request method.

The log messages are also recorded under a wrong module

2021-10-11 10:29:33,153 INFO [agent_cache:96][waitress-0] in_agent_cache called

agent_cache is the name of the py file and not the package it's in.

Any hint if I'm doing something wrong.

Regards
    Estartu






--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/90ae76af-8406-3ec5-b490-2f4af254431d%40augusta.de.

Reply via email to