Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c3848b

Browse files
committed
In cmd_create(), use a redirect directive instead of viewing the page;
this avoids resubmitting POST data. Remove redundant 'Page' from label passed from cmd_new().
1 parent 8ed0204 commit 9c3848b

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Demo/cgi/wiki.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,17 @@ def cmd_create(self, form):
6767
print "<p>An error occurred while attempting to write the file:"
6868
print "<p>", escape(error)
6969
else:
70-
self.cmd_view(form)
70+
# Use a redirect directive, to avoid "reload page" problems
71+
print "<head>"
72+
s = '<meta http-equiv="refresh" content="1; URL=%s">'
73+
print s % (self.scripturl + "?cmd=view&page=" + self.name)
74+
print "<head>"
75+
print "<h1>OK</h1>"
76+
print "<p>If nothing happens, please click here:",
77+
print self.mklink("view", self.name, self.name)
7178

7279
def cmd_new(self, form):
73-
self.cmd_edit(form, label="Create Page")
80+
self.cmd_edit(form, label="Create")
7481

7582
def iswikiword(self, word):
7683
return re.match("[A-Z][a-z]+([A-Z][a-z]*)+", word)

0 commit comments

Comments
 (0)