got rid of some unnecessary regex in the fixtures function

This commit is contained in:
ronnyabraham 2020-08-31 20:16:33 +03:00
parent f64b235eae
commit 15370c4a28

View file

@ -52,8 +52,8 @@ def commandline(args="", workingdir=None):
args=args,
djangosettings=configuration.imports.settings,)
else:
commandline = "{djangoroot}/manage.py {args} --pythonpath='{djangoroot}'" \
" --settings={djangosettings}".format(
commandline = "{djangoroot}/manage.py {args} --pythonpath='"\
"{djangoroot}' --settings={djangosettings}".format(
djangoroot=configuration.paths.django.root,
args=args,
djangosettings=configuration.imports.settings,)
@ -89,7 +89,8 @@ def manage(args="", workingdir=None):
shell='/bin/bash')
with cd(configuration.paths.django.root):
cmd = "{djangoroot}/manage.py {args} --pythonpath='{djangoroot}' " \
cmd = "{djangoroot}/manage.py {args} " \
" --pythonpath='{djangoroot}' " \
"--settings={djangosettings}".format(
djangoroot=configuration.paths.django.root,
args=args,
@ -285,9 +286,10 @@ def create_project():
if exists(project_path_old):
prompt_continue(
message="found an already existing old version of "
"{project_path}, do you want to ignore backing up the version or exit? Y/n"
"( Y to continue without backing up. N to exit )", default="n")
message="found an already existing old "
"version of {project_path}, do you want to ignore"
" backing up the version or exit? Y/n ( Y to "
"continue without backing up. N to exit )", default="n")
fabric_ops.run("rm -Rf {project_path}/{project_name}".format(
project_name=project_name,
@ -880,7 +882,7 @@ def fixtures(appname=None, backup=False):
try:
pos = match.end()
output = output[pos:]
except:
except Exception:
pass
# now find the first occurence of [ on a newline, e.g.
@ -889,12 +891,12 @@ def fixtures(appname=None, backup=False):
# "model.auth": 40,
# etc.
p = re.compile(r"\n\[")
m = p.search(output)
pos = m.end() - 1
output = output[pos:]
# p = re.compile(r"\n\[")
# m = p.search(output)
# pos = m.end() - 1
# output = output[pos:]
from StringIO import StringIO
from io import StringIO
fixture_iostring = StringIO(output)
fabric_ops.put(fixture_iostring, path_fixture)