mirror of https://gitlab.com/bashrc2/epicyon
Extra exceptions
parent
ebed9f5202
commit
dac79d53f9
42
daemon.py
42
daemon.py
|
@ -788,8 +788,18 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
mediaFilename= \
|
||||
self.server.baseDir+'/accounts/login.png'
|
||||
if os.path.isfile(mediaFilename):
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
tries=0
|
||||
mediaBinary=None
|
||||
while tries<5:
|
||||
try:
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
break
|
||||
except Exception as e:
|
||||
print(e)
|
||||
time.sleep(1)
|
||||
tries+=1
|
||||
if mediaBinary:
|
||||
self._set_headers('image/png',len(mediaBinary),cookie)
|
||||
self.wfile.write(mediaBinary)
|
||||
self.wfile.flush()
|
||||
|
@ -801,8 +811,18 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
mediaFilename= \
|
||||
self.server.baseDir+'/accounts/login-background.png'
|
||||
if os.path.isfile(mediaFilename):
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
tries=0
|
||||
mediaBinary=None
|
||||
while tries<5:
|
||||
try:
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
break
|
||||
except Exception as e:
|
||||
print(e)
|
||||
time.sleep(1)
|
||||
tries+=1
|
||||
if mediaBinary:
|
||||
self._set_headers('image/png',len(mediaBinary),cookie)
|
||||
self.wfile.write(mediaBinary)
|
||||
self.wfile.flush()
|
||||
|
@ -814,8 +834,18 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
mediaFilename= \
|
||||
self.server.baseDir+'/accounts/follow-background.png'
|
||||
if os.path.isfile(mediaFilename):
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
tries=0
|
||||
mediaBinary=None
|
||||
while tries<5:
|
||||
try:
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
break
|
||||
except Exception as e:
|
||||
print(e)
|
||||
time.sleep(1)
|
||||
tries+=1
|
||||
if mediaBinary:
|
||||
self._set_headers('image/png',len(mediaBinary),cookie)
|
||||
self.wfile.write(mediaBinary)
|
||||
self.wfile.flush()
|
||||
|
|
Loading…
Reference in New Issue