commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9897 - trunk/gnue-forms/src/uidrivers/_base


From: reinhard
Subject: [gnue] r9897 - trunk/gnue-forms/src/uidrivers/_base
Date: Sun, 26 Oct 2008 13:05:00 -0500 (CDT)

Author: reinhard
Date: 2008-10-26 13:05:00 -0500 (Sun, 26 Oct 2008)
New Revision: 9897

Modified:
   trunk/gnue-forms/src/uidrivers/_base/UIdriver.py
Log:
Use os.path.join in search for widget implementations for more portability.
Don't obfuscate errors which happen on importing widget implementations.


Modified: trunk/gnue-forms/src/uidrivers/_base/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/_base/UIdriver.py    2008-10-23 13:47:44 UTC 
(rev 9896)
+++ trunk/gnue-forms/src/uidrivers/_base/UIdriver.py    2008-10-26 18:05:00 UTC 
(rev 9897)
@@ -135,16 +135,15 @@
       basedir  = os.path.dirname (sys.modules [self.__module__].__file__)
 
     uiDriver = os.path.basename (basedir)
-    basedir +='/widgets/'
+    basedir = os.path.join(basedir, "widgets")
     for widgetName in dircache.listdir (basedir):
-      try:
         # _xxx are abstract classes, .xxx are hidden dirs (like ".svn")
         if widgetName [0] != '_' and widgetName [0] != '.':
-          if os.path.isdir (basedir + widgetName):
+          if os.path.isdir(os.path.join(basedir, widgetName)):
             # Directories: import as module
             widget = dyn_import ('gnue.forms.uidrivers.%s.widgets.%s' \
                                  % (uiDriver, widgetName))
-          elif os.path.isfile (basedir + widgetName):
+          elif os.path.isfile (os.path.join(basedir, widgetName)):
             # Files: import only .py (not .pyc or .pyo or anything else)
             (widgetName, ext) = os.path.splitext (widgetName)
             if ext == '.py':
@@ -156,12 +155,7 @@
           except Exception, mesg:
             raise ImportError, mesg
 
-      except ImportError, mesg:
-        assert gDebug (1, "%s.widgets.%s doesn't appear to be a valid ui 
widget" \
-                   % (uiDriver, widgetName))
-        assert gDebug (1, ' --> %s' % mesg)
 
-
   # ---------------------------------------------------------------------------
   # Build the user interface
   # ---------------------------------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]