SVN: r25586 - trunk/quixote

David Binger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Fri, 12 Nov 2004 08:59:07 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: dbinger
Date: 2004-11-12 06:12:37 -0500 (Fri, 12 Nov 2004)
New Revision: 25586

Modified:
   trunk/quixote/publish.py
   trunk/quixote/util.py
Log:
Remove unused local function _get_module() from publish.
Modify util.import_object() so that it works for names without dots.


Modified: trunk/quixote/publish.py
===================================================================
--- trunk/quixote/publish.py	2004-11-12 00:56:59 UTC (rev 25585)
+++ trunk/quixote/publish.py	2004-11-12 11:12:37 UTC (rev 25586)
@@ -16,12 +16,6 @@
 from quixote.http_response import HTTPResponse
 from quixote.logger import DefaultLogger
 
-def _get_module(name):
-    """Get a module object by name."""
-    __import__(name)
-    module = sys.modules[name]
-    return module
-
 # Error message to dispay when DISPLAY_EXCEPTIONS in config file is not
 # true.  Note that SERVER_ADMIN must be fetched from the environment and
 # plugged in here -- we can't do it now because the environment isn't

Modified: trunk/quixote/util.py
===================================================================
--- trunk/quixote/util.py	2004-11-12 00:56:59 UTC (rev 25585)
+++ trunk/quixote/util.py	2004-11-12 11:12:37 UTC (rev 25586)
@@ -70,10 +70,14 @@
 
 def import_object(name):
     i = name.rfind('.')
-    module_name = name[:i]
-    object_name = name[i+1:]
-    __import__(module_name)
-    return getattr(sys.modules[module_name], object_name)
+    if i != -1:
+        module_name = name[:i]
+        object_name = name[i+1:]
+        __import__(module_name)
+        return getattr(sys.modules[module_name], object_name)
+    else:
+        __import__(name)        
+        return sys.modules[name]
 
 def xmlrpc(request, func):
     """xmlrpc(request:Request, func:callable) : string