changeset 4594:d706f5d4f4ec 1.9.0beta1

fix ScriptContext URL default value
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 16 Feb 2009 00:07:22 +0100
parents d275bd03a732
children 59728f08e040
files MoinMoin/action/SubscribeUser.py MoinMoin/mail/mailimport.py MoinMoin/packages.py MoinMoin/script/__init__.py MoinMoin/web/contexts.py
diffstat 5 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/SubscribeUser.py	Sun Feb 15 23:46:10 2009 +0100
+++ b/MoinMoin/action/SubscribeUser.py	Mon Feb 16 00:07:22 2009 +0100
@@ -114,7 +114,7 @@
     if len(args) > 3:
         request_url = args[3]
     else:
-        request_url = "localhost/"
+        request_url = None
 
     # Setup MoinMoin environment
     from MoinMoin.web.contexts import ScriptContext
--- a/MoinMoin/mail/mailimport.py	Sun Feb 15 23:46:10 2009 +0100
+++ b/MoinMoin/mail/mailimport.py	Mon Feb 16 00:07:22 2009 +0100
@@ -314,7 +314,7 @@
     if len(sys.argv) > 1:
         request_url = sys.argv[1]
     else:
-        request_url = 'localhost/'
+        request_url = None
 
     from MoinMoin.web.contexts import ScriptContext
     request = ScriptContext(url=request_url)
--- a/MoinMoin/packages.py	Sun Feb 15 23:46:10 2009 +0100
+++ b/MoinMoin/packages.py	Mon Feb 16 00:07:22 2009 +0100
@@ -526,7 +526,7 @@
     if len(args) > 3:
         request_url = args[3]
     else:
-        request_url = "localhost/"
+        request_url = None
 
     # Setup MoinMoin environment
     from MoinMoin.web.contexts import ScriptContext
--- a/MoinMoin/script/__init__.py	Sun Feb 15 23:46:10 2009 +0100
+++ b/MoinMoin/script/__init__.py	Mon Feb 16 00:07:22 2009 +0100
@@ -174,10 +174,8 @@
     def init_request(self):
         """ create request """
         from MoinMoin.web.contexts import ScriptContext
-        if self.options.wiki_url:
-            self.request = ScriptContext(self.options.wiki_url, self.options.page)
-        else:
-            self.request = ScriptContext(pagename=self.options.page)
+        url = self.options.wiki_url or None
+        self.request = ScriptContext(url, self.options.page)
 
     def mainloop(self):
         # Insert config dir or the current directory to the start of the path.
--- a/MoinMoin/web/contexts.py	Sun Feb 15 23:46:10 2009 +0100
+++ b/MoinMoin/web/contexts.py	Mon Feb 16 00:07:22 2009 +0100
@@ -409,7 +409,9 @@
     For input, sys.stdin is used as 'wsgi.input', output is written directly
     to sys.stdout though.
     """
-    def __init__(self, url='CLI', pagename=''):
+    def __init__(self, url=None, pagename=''):
+        if url is None:
+            url = 'http://localhost:0/' # just some somehow valid dummy URL
         environ = create_environ(base_url=url) # XXX not sure about base_url, but makes "make underlay" work
         environ['HTTP_USER_AGENT'] = 'CLI/Script'
         environ['wsgi.input'] = sys.stdin