mirror of
https://abf.rosa.ru/djam/abf-console-client-src.git
synced 2025-02-24 02:12:49 +00:00
Be py3-ready
This commit is contained in:
parent
63f2ebb596
commit
8bba856e1e
1 changed files with 3 additions and 3 deletions
|
@ -89,7 +89,7 @@ class AbfJson(object):
|
||||||
def process_response(self, response_string):
|
def process_response(self, response_string):
|
||||||
try:
|
try:
|
||||||
res = json.loads(response_string)
|
res = json.loads(response_string)
|
||||||
except ValueError, ex:
|
except ValueError as ex:
|
||||||
self.log.error(_("Internal server error: it has returned non-json data. "))
|
self.log.error(_("Internal server error: it has returned non-json data. "))
|
||||||
print(response_string)
|
print(response_string)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
@ -164,7 +164,7 @@ class AbfJson(object):
|
||||||
result = urllib2.urlopen(request)
|
result = urllib2.urlopen(request)
|
||||||
res = result.read()
|
res = result.read()
|
||||||
etag_new = result.headers.getheaders('ETag')[0]
|
etag_new = result.headers.getheaders('ETag')[0]
|
||||||
except urllib2.HTTPError, ex:
|
except urllib2.HTTPError as ex:
|
||||||
if ex.code == 304: # data was not modified
|
if ex.code == 304: # data was not modified
|
||||||
res = cache_data.get(etag)
|
res = cache_data.get(etag)
|
||||||
self.log.debug(_('Getting cached result (cache was validated)'))
|
self.log.debug(_('Getting cached result (cache was validated)'))
|
||||||
|
@ -294,7 +294,7 @@ class AbfJson(object):
|
||||||
URL = self.file_store_url + '/api/v1/file_stores/' + sha_hash
|
URL = self.file_store_url + '/api/v1/file_stores/' + sha_hash
|
||||||
try:
|
try:
|
||||||
response = urllib2.urlopen(URL)
|
response = urllib2.urlopen(URL)
|
||||||
except urllib2.HTTPError, ex:
|
except urllib2.HTTPError as ex:
|
||||||
if ex.code == 404: # data was not modified
|
if ex.code == 404: # data was not modified
|
||||||
raise PageNotFoundError(_('File with hash %s can not be downloaded from File-Store.') % sha_hash)
|
raise PageNotFoundError(_('File with hash %s can not be downloaded from File-Store.') % sha_hash)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue