[Zope-Checkins] CVS: Zope/lib/python/OFS - Application.py:1.191.2.9
Chris McDonough
chrism at plope.com
Sun Jan 11 10:32:16 EST 2004
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv8546/lib/python/OFS
Modified Files:
Tag: Zope-2_7-branch
Application.py
Log Message:
Don't throw misleading warnings about duplicate products on product path unless there actually are duplicate products on product path. Also, add unit tests for product initialization.
=== Zope/lib/python/OFS/Application.py 1.191.2.8 => 1.191.2.9 ===
--- Zope/lib/python/OFS/Application.py:1.191.2.8 Thu Jan 8 18:33:47 2004
+++ Zope/lib/python/OFS/Application.py Sun Jan 11 10:31:45 2004
@@ -596,11 +596,19 @@
for product_dir in Products.__path__:
product_names=os.listdir(product_dir)
for name in product_names:
- priority = (name != 'PluginIndexes') # import PluginIndexes 1st
- # i is used as sort ordering in case a conflict exists
- # between Product names. Products will be found as
- # per the ordering of Products.__path__
- products.append((priority, name, i, product_dir))
+ fullpath = os.path.join(product_dir, name)
+ # Products must be directories
+ if os.path.isdir(fullpath):
+ # Products must be directories with an __init__.py[co]
+ if ( os.path.exists(os.path.join(fullpath, '__init__.py')) or
+ os.path.exists(os.path.join(fullpath, '__init__.pyo')) or
+ os.path.exists(os.path.join(fullpath, '__init__.pyc')) ):
+ # import PluginIndexes 1st (why?)
+ priority = (name != 'PluginIndexes')
+ # i is used as sort ordering in case a conflict exists
+ # between Product names. Products will be found as
+ # per the ordering of Products.__path__
+ products.append((priority, name, i, product_dir))
i = i + 1
products.sort()
return products
@@ -621,6 +629,7 @@
continue
done[product_name]=product_dir
import_product(product_dir, product_name, raise_exc=debug_mode)
+ return done.keys()
def import_product(product_dir, product_name, raise_exc=0, log_exc=1):
path_join=os.path.join
More information about the Zope-Checkins
mailing list