[Zope-CVS] CVS: Products/Basket - icon_egg.gif:1.1 __init__.py:1.14
utils.py:1.18
Chris McDonough
chrism at plope.com
Wed Nov 9 14:39:55 EST 2005
Update of /cvs-repository/Products/Basket
In directory cvs.zope.org:/tmp/cvs-serv20828
Modified Files:
__init__.py utils.py
Added Files:
icon_egg.gif
Log Message:
Change meta type of Egg Product, give EggProduct a different "installed" icon, make it possible to point entry points and non-callables.
=== Added File Products/Basket/icon_egg.gif ===
<Binary-ish file>
=== Products/Basket/__init__.py 1.13 => 1.14 ===
--- Products/Basket/__init__.py:1.13 Tue Nov 8 21:28:02 2005
+++ Products/Basket/__init__.py Wed Nov 9 14:39:24 2005
@@ -1,8 +1,8 @@
import sys
import os
import pkg_resources
-import inspect
from utils import EggProductContext
+from utils import EggProduct
entrypoint_group = 'zope2.initialize'
@@ -23,6 +23,8 @@
return L
def initialize(self, context):
+ context.registerClass(EggProduct, constructors = (('dummy',None),),
+ visibility=None, icon='icon_egg.gif')
if not self.pre_initialized:
try:
home = INSTANCE_HOME
@@ -34,7 +36,7 @@
data = []
points = pkg_resources.iter_entry_points(entrypoint_group)
# Grab app from Zope product context
- # It's a "protected" attributes, hence the name mangling
+ # It's a "protected" attribute, hence the name mangling
app = context._ProductContext__app
meta_types = []
for point in points:
=== Products/Basket/utils.py 1.17 => 1.18 ===
--- Products/Basket/utils.py:1.17 Tue Nov 8 22:07:13 2005
+++ Products/Basket/utils.py Wed Nov 9 14:39:24 2005
@@ -39,6 +39,9 @@
_marker = ()
class EggProduct(Product):
+
+ meta_type = 'Egg Product'
+
def __init__(self, id, title, packagename):
self.id = id
self.title = title
@@ -117,7 +120,7 @@
error=sys.exc_info())
products._setObject(productname, product)
- product.icon = 'p_/InstalledProduct_icon'
+ product.icon = 'misc_/Basket/icon_egg.gif'
product.version = fver
product.home = str(self.package.__path__)
@@ -210,7 +213,7 @@
if icon and instance_class is not None:
setattr(instance_class, 'icon', 'misc_/%s/%s' %
- (product.id, os.path.split(icon)[1]))
+ (product.id, os.basename(icon)))
if permissions:
self.register_additional_permissions(permissions)
@@ -417,7 +420,11 @@
try:
self.set_package_module_aliases()
self.set_package_misc_attrs()
- init_data = initializer(self)
+ # allow entry points that are "dummies" (e.g. just the module)
+ # in case the product doesn't have an initialize function that
+ # needs to be called
+ if callable(initializer):
+ init_data = initializer(self)
self.set_package_ac_permissions()
self.munge_package_meta_types()
self.set_package_methods()
More information about the Zope-CVS
mailing list