mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Further tidyup to avoid some situations occuring
This commit is contained in:
@@ -16,8 +16,8 @@ class CachedDocumentManager(models.Manager):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def get_document_id(self, url_path, params):
|
def get_document_id(self, url_path, params):
|
||||||
p = params.copy()
|
if params:
|
||||||
if p:
|
p = params.copy()
|
||||||
if 'service' in p:
|
if 'service' in p:
|
||||||
del p['service']
|
del p['service']
|
||||||
paramstr = urllib.urlencode(p)
|
paramstr = urllib.urlencode(p)
|
||||||
@@ -35,14 +35,12 @@ class CachedDocumentManager(models.Manager):
|
|||||||
|
|
||||||
method = 'GET'
|
method = 'GET'
|
||||||
paramstr = ''
|
paramstr = ''
|
||||||
|
service = 'auth'
|
||||||
|
|
||||||
print params
|
|
||||||
if params:
|
if params:
|
||||||
if 'service' in params:
|
if 'service' in params:
|
||||||
service = params['service']
|
service = params['service']
|
||||||
del params['service']
|
del params['service']
|
||||||
else:
|
|
||||||
service = 'auth'
|
|
||||||
paramstr = urllib.urlencode(params)
|
paramstr = urllib.urlencode(params)
|
||||||
|
|
||||||
if len(paramstr.strip()) > 0:
|
if len(paramstr.strip()) > 0:
|
||||||
@@ -52,8 +50,6 @@ class CachedDocumentManager(models.Manager):
|
|||||||
conn = httplib.HTTPConnection(API_URL)
|
conn = httplib.HTTPConnection(API_URL)
|
||||||
conn.request(method, url_path, paramstr, headers)
|
conn.request(method, url_path, paramstr, headers)
|
||||||
response = conn.getresponse()
|
response = conn.getresponse()
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user