Fix revision rendering and make use of ascii_letters.

This commit is contained in:
Ryan Stein 2017-10-29 21:38:16 -04:00
parent c5c44f3e0c
commit 8dc51b9fb4
2 changed files with 6 additions and 9 deletions

View file

@ -19,7 +19,6 @@ See www.evennia.com for full documentation.
"""
from builtins import object
# Delayed loading of properties
@ -104,7 +103,10 @@ def _create_version():
except IOError as err:
print(err)
try:
version = "%s (rev %s)" % (version, check_output("git rev-parse --short HEAD", shell=True, cwd=root, stderr=STDOUT).strip())
rev = check_output(
"git rev-parse --short HEAD",
shell=True, cwd=root, stderr=STDOUT).strip().decode()
version = "%s (rev %s)" % (version, rev)
except (IOError, CalledProcessError):
# ignore if we cannot get to git
pass
@ -314,8 +316,3 @@ def _init():
syscmdkeys = SystemCmds()
del SystemCmds
del _EvContainer
del object
del absolute_import
del print_function

View file

@ -412,7 +412,7 @@ def evennia_version():
try:
rev = check_output(
"git rev-parse --short HEAD",
shell=True, cwd=EVENNIA_ROOT, stderr=STDOUT).strip()
shell=True, cwd=EVENNIA_ROOT, stderr=STDOUT).strip().decode()
version = "%s (rev %s)" % (version, rev)
except (IOError, CalledProcessError):
# move on if git is not answering
@ -502,7 +502,7 @@ def create_secret_key():
"""
import random
import string
secret_key = list((string.letters +
secret_key = list((string.ascii_letters +
string.digits + string.punctuation).replace("\\", "")
.replace("'", '"').replace("{", "_").replace("}", "-"))
random.shuffle(secret_key)