Commit c0ed09ae authored by 's avatar

- removed deprecated support for '__ac_permissions__' and 'meta_types'

parent 46a537db
...@@ -18,6 +18,9 @@ Zope Changes ...@@ -18,6 +18,9 @@ Zope Changes
Restructuring Restructuring
- Removed deprecated support for product initialization based on
'__ac_permissions__' and 'meta_types' attributes.
- removed zLOG module which was deprecated since Zope 2.9 - removed zLOG module which was deprecated since Zope 2.9
Features added Features added
......
...@@ -778,57 +778,35 @@ def install_product(app, product_dir, product_name, meta_types, ...@@ -778,57 +778,35 @@ def install_product(app, product_dir, product_name, meta_types,
product, product_name, package_dir, app) product, product_name, package_dir, app)
context=ProductContext(productObject, app, product) context=ProductContext(productObject, app, product)
# Look for an 'initialize' method in the product. If it does # Look for an 'initialize' method in the product.
# not exist, then this is an old product that has never been
# updated. In that case, we will analyze the product and
# build up enough information to do initialization manually.
initmethod=pgetattr(product, 'initialize', None) initmethod=pgetattr(product, 'initialize', None)
if initmethod is not None: if initmethod is not None:
initmethod(context) initmethod(context)
# Support old-style product metadata. Older products may
# define attributes to name their permissions, meta_types,
# constructors, etc.
permissions={} permissions={}
new_permissions={} new_permissions={}
if pgetattr(product, '__ac_permissions__', None) is not None: if pgetattr(product, '__ac_permissions__', None) is not None:
warn('__init__.py of %s has a long deprecated ' warn("__init__.py of %s has a long deprecated "
'\'__ac_permissions__\' attribute. ' "'__ac_permissions__' attribute. '__ac_permissions__' "
'\'__ac_permissions__\' will be ignored by ' "is now ignored by install_product. Please use "
'install_product in Zope 2.10. Please use registerClass ' "registerClass instead."
'instead.' % product.__name__, % product.__name__,
DeprecationWarning) DeprecationWarning)
for p in pgetattr(product, '__ac_permissions__', ()):
permission, names, default = (
tuple(p)+('Manager',))[:3]
if names:
for name in names:
permissions[name]=permission
elif not folder_permissions.has_key(permission):
new_permissions[permission]=()
if pgetattr(product, 'meta_types', None) is not None: if pgetattr(product, 'meta_types', None) is not None:
warn('__init__.py of %s has a long deprecated \'meta_types\' ' warn("__init__.py of %s has a long deprecated 'meta_types' "
'attribute. \'meta_types\' will be ignored by ' "attribute. 'meta_types' is now ignored by "
'install_product in Zope 2.10. Please use registerClass ' "install_product. Please use registerClass instead."
'instead.' % product.__name__, % product.__name__,
DeprecationWarning) DeprecationWarning)
for meta_type in pgetattr(product, 'meta_types', ()):
# Modern product initialization via a ProductContext
# adds 'product' and 'permission' keys to the meta_type
# mapping. We have to add these here for old products.
pname=permissions.get(meta_type['action'], None)
if pname is not None:
meta_type['permission']=pname
meta_type['product']=productObject.id
meta_type['visibility'] = 'Global'
meta_types.append(meta_type)
if pgetattr(product, 'methods', None) is not None: if pgetattr(product, 'methods', None) is not None:
warn('__init__.py of %s has a long deprecated \'methods\' ' warn("__init__.py of %s has a long deprecated 'methods' "
'attribute. \'methods\' will be ignored by ' "attribute. 'methods' support might be removed in Zope "
'install_product in Zope 2.10. Please use registerClass ' "2.11 or a later feature release. Please use the "
'instead.' % product.__name__, "'legacy' argument of registerClass instead if the "
"methods are constructors. Or refactor the product "
"using adapters." % product.__name__,
DeprecationWarning) DeprecationWarning)
for name,method in pgetattr( for name,method in pgetattr(
product, 'methods', {}).items(): product, 'methods', {}).items():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment