summaryrefslogtreecommitdiffstats
path: root/flatpages
diff options
context:
space:
mode:
authorexpo <expo@expobox.potato.hut>2012-08-12 19:10:23 +0200
committerexpo <expo@expobox.potato.hut>2012-08-12 19:10:23 +0200
commit28047277f1fb0679c3b94bb5a14d2384a94cc27f (patch)
treeaef1c4569ab3807e5aed76512c42ae3cee9d0ca8 /flatpages
parent5ff163efaa0c5c6d154b1f47991d41ec4abfccef (diff)
downloadtroggle-28047277f1fb0679c3b94bb5a14d2384a94cc27f.tar.gz
troggle-28047277f1fb0679c3b94bb5a14d2384a94cc27f.tar.bz2
troggle-28047277f1fb0679c3b94bb5a14d2384a94cc27f.zip
Started removing foreignkeys to caves, to achieve greater flexability. Some log book entries stuff may be broken. Add ability to make new caves and entrances via website.
Diffstat (limited to 'flatpages')
-rw-r--r--flatpages/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/flatpages/views.py b/flatpages/views.py
index 3a1bc40..cc1feef 100644
--- a/flatpages/views.py
+++ b/flatpages/views.py
@@ -128,7 +128,6 @@ def editflatpage(request, path):
if request.method == 'POST': # If the form has been submitted...
flatpageForm = FlatPageForm(request.POST) # A form bound to the POST data
if flatpageForm.is_valid():# Form valid therefore write file
- f = open(filepath, "w")
if filefound:
headmatch = re.match(r"(.*)<title>.*</title>(.*)", head, re.DOTALL + re.IGNORECASE)
if headmatch:
@@ -144,7 +143,9 @@ def editflatpage(request, path):
postbody = "</html>"
body = flatpageForm.cleaned_data["html"]
body = body.replace("\r", "")
- f.write("%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody))
+ result = u"%s<head%s>%s</head>%s<body%s>\n%s</body>%s" % (preheader, headerargs, head, postheader, bodyargs, body, postbody)
+ f = open(filepath, "w")
+ f.write(result)
f.close()
return HttpResponseRedirect(reverse('flatpage', args=[path])) # Redirect after POST
else: