Simplify url of editor page
authorBernie Innocenti <bernie@codewiz.org>
Tue, 12 Oct 2010 13:35:09 +0000 (09:35 -0400)
committerBernie Innocenti <bernie@codewiz.org>
Tue, 12 Oct 2010 13:35:09 +0000 (09:35 -0400)
geekigeeki.py

index 788006001301cb9071f6322abb8807787de3f8f2..147b129fd4c9402ac8512f1bc55259aa1d302987 100755 (executable)
@@ -230,7 +230,7 @@ def handle_atom(pagename, form):
     Page(pagename).send_atom()
 
 def handle_edit(pagename, form):
-    pg  = Page(form['q'].value)
+    pg  = Page(pagename)
     if 'save' in form:
         if form['file'].value:
             pg.save(form['file'].file.read(), form['changelog'].value)
@@ -575,7 +575,7 @@ class Page:
         except IOError, err:
             if err.errno == errno.ENOENT:
                 if default is None:
-                    default = '//[[?a=edit&q=%s|Describe %s]]//' % (self.page_name, self.page_name)
+                    default = '//[[%s?a=edit|Describe %s]]//' % (self.page_name, self.page_name)
                 return default
             if err.errno == errno.EISDIR:
                 return self.format_dir()
@@ -663,7 +663,7 @@ class Page:
         editable = name and self.can_write() and is_privileged()
         if editable:
             print(' <link rel="alternate" type="application/x-wiki" title="Edit this page" href="%s" />' \
-                % relative_url('?a=edit&q=' + name, privileged=True))
+                % relative_url(name + '?a=edit', privileged=True))
 
         history = config_get('history_url')
         if history is not None:
@@ -674,7 +674,7 @@ class Page:
 
         # BODY
         if editable:
-            print('<body ondblclick="location.href=\'' + relative_url('?a=edit&q=' + name, privileged=True) + '\'">')
+            print('<body ondblclick="location.href=\'' + relative_url(name + '?a=edit', privileged=True) + '\'">')
         else:
             print('<body>')
 
@@ -701,13 +701,13 @@ class Page:
             print(' | ' + link_tag(name + '?a=raw', 'Raw Text', cssclass='navlink'))
             if config_get('privileged_url') is not None:
                 if self.can_write():
-                    print(' | ' + link_tag('?a=edit&q=' + name, 'Edit', cssclass='navlink', privileged=True))
+                    print(' | ' + link_tag(name + '?a=edit', 'Edit', cssclass='navlink', privileged=True))
                 else:
-                    print(' | ' + link_tag(name, 'Login', cssclass='navlink', privileged=True))
+                    print(' | ' + link_tag(name, 'Login', cssclass='login', privileged=True))
 
         user = remote_user()
         if user != 'AnonymousCoward':
-            print(' | <span class="login"><i><b>' + link_tag('User/' + user, user) + '</b></i></span>')
+            print(' | ' + link_tag('user/' + user, user, cssclass='login'))
 
         print('<hr /></div></nav>')