Fix editing and humanized links
authorBernie Innocenti <bernie@codewiz.org>
Sat, 2 May 2009 09:44:07 +0000 (11:44 +0200)
committerBernie Innocenti <bernie@codewiz.org>
Sat, 2 May 2009 09:44:07 +0000 (11:44 +0200)
geekigeeki.py

index a36eced13ff809056a7aae93d66ef79e4fbd32ed..afaebefc6a4321560a861d04f174c7d8661a304b 100755 (executable)
@@ -80,7 +80,7 @@ def permalink(s):
     return re.sub(' ', '-', re.sub('[^a-z0-9_ ]', '', s.lower()).strip())
 
 def humanlink(s):
-    return re.sub(r'([^:/\.]+)(?:\.[^/:]+|)$', r'\1', s.replace('_', ' '))
+    return re.sub(r'(?:.*[/:]|)([^:/\.]+)(?:\.[^/:]+|)$', r'\1', s.replace('_', ' '))
 
 # Split arg lists like "blah| blah blah| width=100 | align = center",
 # return a list containing anonymous arguments and a map containing the named arguments
@@ -742,7 +742,7 @@ class Page:
             + ' from ' + cgi.escape(get_hostname(remote_host()))
             + '</b></p>'))
         print('<div class="editor"><form name="editform" method="post" enctype="multipart/form-data" action="%s">' % relative_url(self.page_name))
-        print('<input type="hidden" name="edit" value="%s">' % (self.page_name))
+        print('<input type="hidden" name="a" value="edit" /><input type="hidden" name="q" value="' + self.page_name + '" />')
         print('<input type="input" id="editor" name="changelog" value="Edit page %s" accesskey="c" /><br />' % (self.page_name))
         print('<textarea wrap="off" spellcheck="true" id="editor" name="savetext" rows="17" cols="100" accesskey="e">%s</textarea>' \
             % cgi.escape(preview or self.get_raw_body(default='')))