[patch] gnue.common.apps.plugin.__modules() and *.py[co]

Radoslaw Zielinski <[email protected]>
Newsgroups gmane.comp.gnu.enterprise.devel
Message-ID <20050707140937.GA7645@kicia>
I had a problem with gnue-appserver complaining about non-existant plugin
(xmlrpc); it was caused by gnue.common.apps.plugin.__modules()'s lack
of support for optimized *.py[co] files.

Patch attached.

-- 
RadosÂław ZieliĂąski <[email protected]>

_______________________________________________
Gnue-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnue-dev
gnue-common.patch (text/plain, 920 B)
--- gnue-common-0.5.14/src/apps/plugin.py	2005-02-11 17:17:43.000000000 +0100
+++ gnue-common-0.5.14/src/apps/plugin.py	2005-07-07 15:58:35.000000000 +0200
@@ -200,9 +200,13 @@
     (subname, subext) = os.path.splitext (subfile)
     subpath = os.path.join (basedir, subfile)
     # We are only interested in Python modules or packages
-    if (not want_packages and subext == '.py' and subname != '__init__') or \
+    if (not want_packages and
+        (subext == '.py' or subext == '.pyc' or subext == '.pyo')
+        and subname != '__init__') or \
        (os.path.isdir (subpath) and \
-        os.path.isfile (os.path.join (subpath, '__init__.py'))):
+        (os.path.isfile (os.path.join (subpath, '__init__.py'))  or
+         os.path.isfile (os.path.join (subpath, '__init__.pyc')) or
+         os.path.isfile (os.path.join (subpath, '__init__.pyo')))):
       result = result + [subname]
   return result
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.