[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - Addable.py:1.1.2.1
Jim Fulton
jim@zope.com
Tue, 20 Nov 2001 16:05:03 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv10885
Added Files:
Tag: Zope-3x-branch
Addable.py
Log Message:
first-cut addable registry
=== Added File Zope3/lib/python/Zope/App/ZMI/Addable.py ===
"Keep track of add-menu contents"
_reg = []
def provideAddable(id, title, description):
_reg.append(Addable(id, title, description))
def getAddables(ob):
return _reg
def _clear(): del _reg[:]
class Addable:
def __init__(self, id, title, description):
self.id=id
self.title=title
self.description=description
def __eq__(self, other):
try:
i, t, d = other.id, other.title, other.description
except AttributeError:
return 0
return self.id == i and self.title == t and self.description == d
def __repr__(self):
return "%(id)s: %(title)s\n\n%(description)s" % self.__dict__