1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-08-13 16:53:54 -04:00

Fixed bug in cache controller that was causing session handler to return NoneType

This commit is contained in:
echel0n 2014-03-29 01:45:49 -07:00
parent f0ffae31a6
commit c2f7f766f4
2 changed files with 4 additions and 3 deletions

View File

@ -2,13 +2,14 @@ from requests.adapters import HTTPAdapter
from cachecontrol.controller import CacheController
from cachecontrol.cache import DictCache
from cachecontrol.session import CacheControlSession
class CacheControlAdapter(HTTPAdapter):
invalidating_methods = set(['PUT', 'DELETE'])
def __init__(self, sess=None, cache=None, cache_etags=True, *args, **kw):
super(CacheControlAdapter, self).__init__(*args, **kw)
self.sess = sess or CacheControlSession()
self.cache = cache or DictCache()
self.controller = CacheController(sess=sess, cache=cache, cache_etags=cache_etags)

View File

@ -8,7 +8,7 @@ import datetime
from cachecontrol.cache import DictCache
from cachecontrol.compat import parsedate_tz
from cachecontrol.session import CacheControlSession
URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?")
@ -28,7 +28,7 @@ class CacheController(object):
def __init__(self, sess=None, cache=None, cache_etags=True):
self.cache = cache or DictCache()
self.cache_etags = cache_etags
self.sess = sess
self.sess = sess or CacheControlSession()
def _urlnorm(self, uri):
"""Normalize the URL to create a safe key for the cache"""