Fix some minor issues in eve_proxy stopping API proxy from working correctly

This commit is contained in:
2012-05-20 11:39:57 +01:00
parent e1dc20ff2e
commit 4a7cde9176
2 changed files with 7 additions and 5 deletions

View File

@@ -119,7 +119,7 @@ class CachedDocumentManager(models.Manager):
# This allows for clock skew not to fuck with the timers.
currenttime = datetime.strptime(dom.getElementsByTagName('currentTime')[0].childNodes[0].nodeValue, '%Y-%m-%d %H:%M:%S')
cacheuntil = datetime.strptime(dom.getElementsByTagName('cachedUntil')[0].childNodes[0].nodeValue, '%Y-%m-%d %H:%M:%S')
date = now() + (cacheuntil - currenttime)
doc.cached_until = now() + (cacheuntil - currenttime)
# Add the global adjustment, to avoid CCP's hardline cache timers
doc.cached_until += timedelta(seconds=getattr(settings, 'EVE_PROXY_GLOBAL_CACHE_ADJUSTMENT', 30))

View File

@@ -1,5 +1,7 @@
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseNotFound, HttpResponseServerError
from django.views.generic import View
from eve_proxy.models import CachedDocument
@@ -22,10 +24,10 @@ class EVEAPIProxyView(View):
if 'userID' in params and not 'service' in params:
return HttpResponse('No Service ID provided.')
try:
cached_doc = CachedDocument.objects.api_query(url_path, params, exceptions=False)
except:
return HttpResponseServerError('Error occured')
#try:
cached_doc = CachedDocument.objects.api_query(url_path, params, exceptions=False)
#except:
# return HttpResponseServerError('Error occured')
if cached_doc:
return HttpResponse(cached_doc.body, mimetype='text/xml')