[Zope-Checkins] CVS: Zope/lib/python/OFS - Application.py:1.200
Chris McDonough
chrism at plope.com
Sun Jan 11 10:33:15 EST 2004
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv8959/lib/python/OFS
Modified Files:
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.199 => 1.200 ===
--- Zope/lib/python/OFS/Application.py:1.199 Sat Dec 20 13:56:05 2003
+++ Zope/lib/python/OFS/Application.py Sun Jan 11 10:32:44 2004
@@ -1,4 +1,4 @@
-##############################################################################
+############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
@@ -585,7 +585,6 @@
Products.meta_types=Products.meta_types+tuple(meta_types)
Globals.default__class_init__(Folder.Folder)
-
def get_products():
""" Return a list of tuples in the form:
[(priority, dir_name, index, base_dir), ...] for each Product directory
@@ -595,11 +594,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
@@ -620,6 +627,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