[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - Addable.py:1.1.2.2

Jim Fulton jim@zope.com
Sat, 9 Feb 2002 09:08:33 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv13527

Modified Files:
      Tag: Zope-3x-branch
	Addable.py 
Log Message:
Refactored addable registry and added separate content and service addables

=== Zope3/lib/python/Zope/App/ZMI/Addable.py 1.1.2.1 => 1.1.2.2 ===
+##############################################################################
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+# 
+##############################################################################
+"""
 
-_reg = []
+Revision information: $Id$
+"""
 
+"Keep track of add-menu contents"
 
-def provideAddable(id, title, description):
-    _reg.append(Addable(id, title, description))
+class Addables:
 
-def getAddables(ob):
-    return _reg
+    def provideAddable(self, id, title, description):
+        self.__reg.append(Addable(id, title, description))
 
-def _clear(): del _reg[:]
+    def getAddables(self, ob):
+        return self.__reg[:]
     
+    def _clear(self):
+        self.__reg = []
+
+    __init__ = _clear
+
+ContentAddables = Addables()
+ServiceAddables = Addables()
+
+def _clear():
+    ContentAddables._clear()
+    ServiceAddables._clear()
 
 class Addable: