[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security - Settings.py:1.1.2.5
Steve Alexander
steve@cat-box.net
Mon, 18 Feb 2002 04:55:17 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security
In directory cvs.zope.org:/tmp/cvs-serv1711
Modified Files:
Tag: Zope-3x-branch
Settings.py
Log Message:
Added some more explanation of the use of a metaclass in comparison with classmethods.
=== Zope3/lib/python/Zope/App/Security/Settings.py 1.1.2.4 => 1.1.2.5 ===
# PermissionSettingMetaClass. See _setDescription and getDescription
# for an example.
+#
+# Except in the case of __str__ and __repr__, adding a method to the
+# metaclass is equivalent to adding a classmethod to the class.
+# So, _setDescription and getDescription could have been added
+# to PermissionSetting as classmethods.
class PermissionSettingMetaClass(type):
def __init__(self, name, bases, namespace):
@@ -39,6 +44,7 @@
__metaclass__=PermissionSettingMetaClass
def __init__(self):
raise TypeError, "Cannot instantiate PermissionSetting objects"
+
class Allow(PermissionSetting): pass