[Checkins] SVN: z3ext.product/trunk/ start work on enclosed sites
product management support
Nikolay Kim
fafhrd at datacom.kz
Tue Aug 5 08:35:55 EDT 2008
Log message for revision 89374:
start work on enclosed sites product management support
Changed:
U z3ext.product/trunk/CHANGES.txt
U z3ext.product/trunk/src/z3ext/product/interfaces.py
U z3ext.product/trunk/src/z3ext/product/product.py
U z3ext.product/trunk/src/z3ext/product/view.py
-=-
Modified: z3ext.product/trunk/CHANGES.txt
===================================================================
--- z3ext.product/trunk/CHANGES.txt 2008-08-05 11:49:40 UTC (rev 89373)
+++ z3ext.product/trunk/CHANGES.txt 2008-08-05 12:35:52 UTC (rev 89374)
@@ -2,6 +2,12 @@
CHANGES
=======
+1.1.0 (2008-08-05)
+------------------
+
+- Implemented product management for enclosed site objects
+
+
1.0.2 (2008-05-26)
------------------
Modified: z3ext.product/trunk/src/z3ext/product/interfaces.py
===================================================================
--- z3ext.product/trunk/src/z3ext/product/interfaces.py 2008-08-05 11:49:40 UTC (rev 89373)
+++ z3ext.product/trunk/src/z3ext/product/interfaces.py 2008-08-05 12:35:52 UTC (rev 89374)
@@ -66,6 +66,9 @@
def listExtensions():
""" list IProductExtension for this product """
+ def isUninstallable():
+ """ is product uninstallable """
+
class IProductExtension(interface.Interface):
""" product extension """
Modified: z3ext.product/trunk/src/z3ext/product/product.py
===================================================================
--- z3ext.product/trunk/src/z3ext/product/product.py 2008-08-05 11:49:40 UTC (rev 89373)
+++ z3ext.product/trunk/src/z3ext/product/product.py 2008-08-05 12:35:52 UTC (rev 89374)
@@ -61,13 +61,13 @@
configure(self, {})
- site = getSiteManager()
+ sm = getSiteManager()
registry = getattr(z3ext.product, self.__product_name__)
- if registry not in site.__bases__:
- site.__bases__ = (registry,) + site.__bases__
+ if registry not in sm.__bases__:
+ sm.__bases__ = (registry,) + sm.__bases__
- event.notify(interfaces.ProductUpdatedEvent(
- self.__product_name__, self))
+ event.notify(
+ interfaces.ProductUpdatedEvent(self.__product_name__, self))
def uninstall(self):
for name, ext in self.items():
@@ -80,19 +80,36 @@
self.__installed__ = False
- site = getSiteManager()
+ sm = getSiteManager()
registry = getattr(z3ext.product, self.__product_name__)
- if registry in site.__bases__:
- bases = list(site.__bases__)
+ if registry in sm.__bases__:
+ bases = list(sm.__bases__)
bases.remove(registry)
- site.__bases__ = tuple(bases)
+ sm.__bases__ = tuple(bases)
- event.notify(interfaces.ProductUninstalledEvent(
- self.__product_name__, self))
+ event.notify(
+ interfaces.ProductUninstalledEvent(self.__product_name__, self))
+ def _checkInstalled(self, sm, registry, seen):
+ if sm in seen:
+ return False
+ seen.insert(sm)
+
+ if registry in sm.__bases__:
+ return True
+
+ for reg in sm.__bases__:
+ if self._checkInstalled(reg, registry, seen):
+ return True
+
+ return False
+
def isInstalled(self):
- return self.__installed__
+ sm = getSiteManager()
+ registry = getattr(z3ext.product, self.__product_name__)
+ seen = set()
+ return self._checkInstalled(sm, registry, seen)
def listExtensions(self):
exts = []
@@ -102,7 +119,12 @@
return exts
+ def isUninstallable(self):
+ sm = getSiteManager()
+ registry = getattr(z3ext.product, self.__product_name__)
+ return registry in sm.__bases__
+
class ProductExtension(Product):
interface.implements(IProductExtension)
Modified: z3ext.product/trunk/src/z3ext/product/view.py
===================================================================
--- z3ext.product/trunk/src/z3ext/product/view.py 2008-08-05 11:49:40 UTC (rev 89373)
+++ z3ext.product/trunk/src/z3ext/product/view.py 2008-08-05 12:35:52 UTC (rev 89374)
@@ -45,7 +45,7 @@
'title': product.__title__,
'description': product.__description__}
- if product.__installed__:
+ if product.isInstalled():
info['configlet'] = product.isAvailable()
installed.append((product.__title__, info))
else:
More information about the Checkins
mailing list