Commit 33143241 authored by prx's avatar prx

bug corrigé

parent b5975d98
Bugs:
-----
- Un message d'erreur sur une exception socket est présent au premier lancement (j'ai regardé mais je n'ai pas encore trouvé d'où ça vient)
- L'élément aside n'est pas collé au footer > C'est grave?
- Bug "dictionnary changed size during iteration" quand on nettoie les torrents dans la page admin
......
......@@ -8,6 +8,8 @@ import socket
import sys
import logging
import tempfile
import requests
if sys.version_info >= (3, 0):
import configparser as cp
......@@ -194,12 +196,7 @@ def randomtext(n):
def is_running():
"""return True if dontpanic is ready to browse"""
if sys.version_info >= (3, 0):
import http.client as http
else:
import httplib as http
"""return True if dontpanic is ready to browse"""
running = False
if os.path.isfile(lock_file):
try:
......@@ -210,21 +207,16 @@ def is_running():
except IOError: # If the file doesn't exist (for example: first run of Don't Panic)
port = 0
conn = http.HTTPConnection("localhost:{}".format(port))
try:
conn.request("GET", "/")
retval = requests.get("http://localhost:{}".format(port))
# If we are here, Don't Panic is already running
running = True
logger.warning("{} is already running".format(progname))
# Warning: Better handle the exception, but ConnectionRefusedError doesn't exist in Python 2.7
# The handler exception in common to both the version of Python is socket.error
except socket.error:
except Exception as e:
# If we are here, Don't Panic is not running
pass
finally:
conn.close()
logger.warning(e)
return running
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment