diff options
author | expo <expo@expobox.potato.hut> | 2012-08-12 19:10:23 +0200 |
---|---|---|
committer | expo <expo@expobox.potato.hut> | 2012-08-12 19:10:23 +0200 |
commit | ecd5bbcb1dbb00cc0d39cdf80151f41c07c6c8b2 (patch) | |
tree | 0899e18f4b9ccbc63e2241c011af0090e09f415d /flatpages/views.py | |
parent | 6d5babd3319fec50f404bf7ad044962bd1f192e9 (diff) | |
download | troggle-ecd5bbcb1dbb00cc0d39cdf80151f41c07c6c8b2.tar.gz troggle-ecd5bbcb1dbb00cc0d39cdf80151f41c07c6c8b2.tar.bz2 troggle-ecd5bbcb1dbb00cc0d39cdf80151f41c07c6c8b2.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/views.py')
-rw-r--r-- | flatpages/views.py | 5 |
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: |