mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Fixed bug in cache controller that was causing session handler to return NoneType
This commit is contained in:
parent
f0ffae31a6
commit
c2f7f766f4
2 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in a new issue