Commit 29303b99 by Guba Sándor

fix pep8

parent 5b769880
...@@ -77,9 +77,11 @@ def accept(): ...@@ -77,9 +77,11 @@ def accept():
data = json.load(rsp) data = json.load(rsp)
newtime = data["new_suspend_time"] newtime = data["new_suspend_time"]
# Parse time from JSON (Create UTC Localized Datetime objec) # Parse time from JSON (Create UTC Localized Datetime objec)
parsed_time = datetime.datetime.strptime(newtime[:-6], "%Y-%m-%d %H:%M:%S.%f").replace(tzinfo=UTC) parsed_time = datetime.datetime.strptime(
newtime[:-6], "%Y-%m-%d %H:%M:%S.%f").replace(tzinfo=UTC)
# Convert to the machine localization # Convert to the machine localization
new_local_time = parsed_time.astimezone(get_localzone()).strftime("%Y-%m-%d %H:%M:%S") new_local_time = parsed_time.astimezone(
get_localzone()).strftime("%Y-%m-%d %H:%M:%S")
except ValueError as e: except ValueError as e:
print "Parsing time failed: %s" % e print "Parsing time failed: %s" % e
except Exception as e: except Exception as e:
...@@ -88,7 +90,8 @@ def accept(): ...@@ -88,7 +90,8 @@ def accept():
logger.exception("renew failed") logger.exception("renew failed")
return False return False
else: else:
print "Renew succeeded. The machine will be suspended at %s." % new_local_time print("Renew succeeded. The machine will be "
"suspended at %s." % new_local_time)
os.remove(file_path) os.remove(file_path)
return True return True
......
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 sign in to comment