[Zope-CVS] CVS: Products/Basket - __init__.py:1.17 utils.py:1.22
Chris McDonough
chrism at plope.com
Wed Nov 9 18:22:58 EST 2005
Update of /cvs-repository/Products/Basket
In directory cvs.zope.org:/tmp/cvs-serv30183
Modified Files:
__init__.py utils.py
Log Message:
Show the eggname in the persistent product object's title.
=== Products/Basket/__init__.py 1.16 => 1.17 ===
--- Products/Basket/__init__.py:1.16 Wed Nov 9 17:31:12 2005
+++ Products/Basket/__init__.py Wed Nov 9 18:22:28 2005
@@ -2,6 +2,7 @@
import os
import pkg_resources
import traceback
+import textwrap
from Products.Basket.utils import EggProductContext
from Products.Basket.utils import EggProduct
@@ -50,22 +51,23 @@
for point in points:
# XXX deal with duplicate product names by raising an exception
# somewhere in here.
+ eggname = ' '.join(textwrap.wrap(point.dist.location, 80))
try:
product_pkg = get_containing_package(point.module_name)
except:
+ zLOG.LOG('Egg Product Init', zLOG.ERROR,
+ 'Problem initializing product with entry point '
+ '"%s" in module "%s"' % (point.name,point.module_name),
+ error=sys.exc_info())
if debug_mode:
raise
else:
- zLOG.LOG('Egg Product Init', zLOG.ERROR,
- 'Problem initializing product with entry point '
- '%s in module %s' % (point.name,point.module_name),
- error=sys.exc_info())
continue
productname = product_pkg.__name__.split('.')[-1]
initializer = get_initializer(point, productname, debug_mode)
context = EggProductContext(productname, initializer, app,
- product_pkg)
+ product_pkg, eggname)
# XXX debug mode conditions raise_exc, log_exc
returned = context.install(debug_mode)
data.append(returned)
=== Products/Basket/utils.py 1.21 => 1.22 ===
--- Products/Basket/utils.py:1.21 Wed Nov 9 17:31:12 2005
+++ Products/Basket/utils.py Wed Nov 9 18:22:28 2005
@@ -65,9 +65,10 @@
InitializeClass(EggProduct)
class EggProductContext(object):
- def __init__(self, productname, initializer, app, package):
+ def __init__(self, productname, initializer, app, package, eggname):
self.productname = productname
self.initializer = initializer
+ self.eggname = eggname
self.app = app
self.package = package
self.product = self.create_product_object()
@@ -102,9 +103,11 @@
# Version hasn't changed. Don't reinitialize.
return old
- f = fver and (" (%s)" % fver)
- product = EggProduct(productname, 'Installed egg product %s%s' %
- (productname, f), packagename)
+ f = fver and ("(%s)" % fver)
+ product = EggProduct(
+ productname,
+ 'Installed egg product %s %s from %s' %
+ (productname, f, self.eggname), packagename)
if old is not None:
self.app._manage_remove_product_meta_type(product)
More information about the Zope-CVS
mailing list