UIDs can come in as strings or longs, check for that instead

This commit is contained in:
2010-06-04 08:51:32 +01:00
parent d626934046
commit ed00301e85
2 changed files with 3 additions and 3 deletions

View File

@@ -51,7 +51,7 @@ class CachedDocumentManager(models.Manager):
conn.request(method, url_path, paramstr, headers) conn.request(method, url_path, paramstr, headers)
response = conn.getresponse() response = conn.getresponse()
print url_path, paramstr, response.status print service, url_path, paramstr, response.status
if response.status == 200: if response.status == 200:
doc_id = self.get_document_id(url_path, params) doc_id = self.get_document_id(url_path, params)
@@ -68,7 +68,7 @@ class CachedDocumentManager(models.Manager):
cached_doc.cached_until = dom.getElementsByTagName('cachedUntil')[0].childNodes[0].nodeValue cached_doc.cached_until = dom.getElementsByTagName('cachedUntil')[0].childNodes[0].nodeValue
# If this is user related, write a log instance # If this is user related, write a log instance
if params and 'userID' in params and params['userID'].isdigit(): if params and 'userID' in params and type(params['userID']) == long:
log = ApiAccessLog() log = ApiAccessLog()
log.userid = params['userID'] log.userid = params['userID']
log.service = service log.service = service

View File

@@ -31,7 +31,7 @@ def retrieve_xml(request):
try: try:
cached_doc = CachedDocument.objects.api_query(url_path, params, exceptions=False) cached_doc = CachedDocument.objects.api_query(url_path, params, exceptions=False)
except: except:
return HttpResponseServerError return HttpResponseServerError('Error occured')
if cached_doc: if cached_doc:
return HttpResponse(cached_doc.body, mimetype='text/xml') return HttpResponse(cached_doc.body, mimetype='text/xml')