Skip to content

Commit

Permalink
save settings back to file after settings changed
Browse files Browse the repository at this point in the history
  • Loading branch information
peitaosu committed Aug 6, 2017
1 parent e6a54bd commit b33e190
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Cardiff_Web/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

cardiff = Cardiff()
cardiff_settings_path = os.path.join(cardiff_path, "settings.json")
cardiff.load_settings(cardiff_settings_path)

repo_path = os.path.join(".", "repositories")

Expand All @@ -20,6 +19,14 @@ def is_set(value):
else:
return True

def load():
cardiff.load_settings(cardiff_settings_path)

def save():
cardiff.save_settings(cardiff_settings_path)

load()

def index(request):
context = {}
context["vcs"] = cardiff.settings["vcs"]
Expand Down Expand Up @@ -52,6 +59,7 @@ def init(request):
cardiff.settings["user.email"] = request.GET["useremail"]
if "repo" in request.GET:
cardiff.exec_cmd(["init", os.path.join(repo_path, request.GET["repo"])])
save()

def about(request):
context = cardiff.settings["information"]
Expand All @@ -64,6 +72,7 @@ def repo(request):
if "useremail" in request.GET:
cardiff.settings["user.email"] = request.GET["useremail"]
cardiff.exec_cmd(["init", request.GET["init"]])
save()
context = {}
vcs = cardiff.setup_vcs()
context["current_repo"] = cardiff.settings["repo"]["current"]
Expand Down

0 comments on commit b33e190

Please sign in to comment.