Issue #1189 resolved

AttributeError in /cherrypy/lib/caching.py for threading._Event

Florijan Hamzic
created an issue

I tried to use caching for js/css files and added this to my js section: [/js] tools.staticdir.on = True tools.staticdir.dir = "scripts" tools.caching.on = True tools.caching.expires = 3600

my site works well but if i reload and browser tries 302 request i get some cherrypy exceptions

i thinks this is related with this #1163 (4th comment some one mentioned this)

127.0.0.1 - - [04/Dec/2012:13:56:09] "GET /js/lib/jquery.watermark.min.js HTTP/1.1" 500 1814 "http://localhost:8888/Home" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"
127.0.0.1 - - [04/Dec/2012:13:56:09] "GET /js/scripts.js HTTP/1.1" 500 1814 "http://localhost:8888/Home" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"
[04/Dec/2012:13:56:09] HTTP Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 653, in respond
    self.hooks.run('before_handler')
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 112, in run
    raise exc
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 102, in run
    hook()
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 62, in __call__
    return self.callback(**self.kwargs)
  File "/usr/lib/python3.3/site-packages/cherrypy/_cptools.py", line 394, in _wrapper
    if _caching.get(**kwargs):
  File "/usr/lib/python3.3/site-packages/cherrypy/lib/caching.py", line 317, in get
    cache_data = cherrypy._cache.get()
  File "/usr/lib/python3.3/site-packages/cherrypy/lib/caching.py", line 225, in get
    debug=self.debug)
  File "/usr/lib/python3.3/site-packages/cherrypy/lib/caching.py", line 84, in wait
    if isinstance(value, threading._Event):
AttributeError: 'module' object has no attribute '_Event'

[04/Dec/2012:13:56:09] HTTP Traceback (most recent call last):
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 653, in respond
    self.hooks.run('before_handler')
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 112, in run
    raise exc
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 102, in run
    hook()
  File "/usr/lib/python3.3/site-packages/cherrypy/_cprequest.py", line 62, in __call__
    return self.callback(**self.kwargs)
  File "/usr/lib/python3.3/site-packages/cherrypy/_cptools.py", line 394, in _wrapper
    if _caching.get(**kwargs):
  File "/usr/lib/python3.3/site-packages/cherrypy/lib/caching.py", line 317, in get
    cache_data = cherrypy._cache.get()
  File "/usr/lib/python3.3/site-packages/cherrypy/lib/caching.py", line 225, in get
    debug=self.debug)
  File "/usr/lib/python3.3/site-packages/cherrypy/lib/caching.py", line 84, in wait
    if isinstance(value, threading._Event):
AttributeError: 'module' object has no attribute '_Event'

If i got some time i will try to fix