Do not try to glob URLs and non glob strings
authorBernie Innocenti <bernie@codewiz.org>
Mon, 7 Sep 2009 19:54:21 +0000 (21:54 +0200)
committerBernie Innocenti <bernie@codewiz.org>
Mon, 7 Sep 2009 19:54:21 +0000 (21:54 +0200)
geekigeeki.py

index 5b26b553da7b344af20ce8d416693d95449f80de..9a05b85ecfa8834fba0636a338e6542966e1c83b 100755 (executable)
@@ -146,7 +146,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal
     editable = name and writable and config_get('privileged_url') is not None
     if editable:
         print(' <link rel="alternate" type="application/x-wiki" title="Edit this page" href="%s" />' \
-            % (privileged_path() + '?a=edit&q=' + name))
+            % relative_url('?a=edit&q=' + name, privileged=True))
 
     history = config_get('history_url')
     if history is not None:
@@ -157,7 +157,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal
 
     # Body
     if editable:
-        print('<body ondblclick="location.href=\'' + privileged_path() + '?a=edit&q=' + name + '\'">')
+        print('<body ondblclick="location.href=\'' + relative_url('?a=edit&q=' + name, privileged=True) + '\'">')
     else:
         print('<body>')
 
@@ -237,10 +237,13 @@ def link_inline(name, descr=None, kvargs={}):
             % (url, url, name)
 
 def link_inline_glob(pattern, descr=None, kvargs={}):
-    s = ''
-    for name in glob.glob(pattern):
-        s += link_inline(name, descr, kvargs)
-    return s
+    if not url_re.match(pattern) and bool(set(pattern) & set('?*[')):
+        s = ''
+        for name in glob.glob(pattern):
+            s += link_inline(name, descr, kvargs)
+        return s
+    else:
+        return link_inline(pattern, descr, kvargs)
 
 # Search ---------------------------------------------------