mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Removed double checking of no_cache which was causing null cached objects.
This commit is contained in:
@@ -25,7 +25,7 @@ class CachedDocumentManager(models.Manager):
|
|||||||
|
|
||||||
return hashlib.sha1('%s?%s' % (url_path, paramstr)).hexdigest()
|
return hashlib.sha1('%s?%s' % (url_path, paramstr)).hexdigest()
|
||||||
|
|
||||||
def cache_from_eve_api(self, url_path, params, no_cache=False):
|
def cache_from_eve_api(self, url_path, params):
|
||||||
"""
|
"""
|
||||||
Connect to the EVE API server, send the request, and cache it to
|
Connect to the EVE API server, send the request, and cache it to
|
||||||
a CachedDocument. This is typically not something you want to call
|
a CachedDocument. This is typically not something you want to call
|
||||||
@@ -77,9 +77,8 @@ class CachedDocumentManager(models.Manager):
|
|||||||
log.save()
|
log.save()
|
||||||
|
|
||||||
# Finish up and return the resulting document just in case.
|
# Finish up and return the resulting document just in case.
|
||||||
if no_cache == False:
|
cached_doc.save()
|
||||||
cached_doc.save()
|
cached_doc = self.get(id=cached_doc.pk)
|
||||||
cached_doc = self.get(id=cached_doc.pk)
|
|
||||||
|
|
||||||
return cached_doc
|
return cached_doc
|
||||||
|
|
||||||
@@ -109,7 +108,7 @@ class CachedDocumentManager(models.Manager):
|
|||||||
current_eve_time = datetime.utcnow()
|
current_eve_time = datetime.utcnow()
|
||||||
|
|
||||||
if not doc or current_eve_time > doc.cached_until:
|
if not doc or current_eve_time > doc.cached_until:
|
||||||
doc = self.cache_from_eve_api(url_path, params, no_cache=no_cache)
|
doc = self.cache_from_eve_api(url_path, params)
|
||||||
|
|
||||||
if doc:
|
if doc:
|
||||||
dom = minidom.parseString(doc.body.encode('utf-8'))
|
dom = minidom.parseString(doc.body.encode('utf-8'))
|
||||||
|
|||||||
Reference in New Issue
Block a user