[Zope3-checkins] SVN: Zope3/trunk/src/zope/security/ Renamed _always_available to _available_by_default as hinted by a XXX.

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Jul 13 12:27:24 EDT 2004


Log message for revision 26453:
  Renamed _always_available to _available_by_default as hinted by a XXX. 
  You need to recompile Zope.
  


Changed:
  U   Zope3/trunk/src/zope/security/_zope_security_checker.c
  U   Zope3/trunk/src/zope/security/checker.py


-=-
Modified: Zope3/trunk/src/zope/security/_zope_security_checker.c
===================================================================
--- Zope3/trunk/src/zope/security/_zope_security_checker.c	2004-07-13 16:17:33 UTC (rev 26452)
+++ Zope3/trunk/src/zope/security/_zope_security_checker.c	2004-07-13 16:27:24 UTC (rev 26453)
@@ -13,7 +13,7 @@
 */
 #include <Python.h>
 
-static PyObject *_checkers, *_defaultChecker, *_always_available, *NoProxy;
+static PyObject *_checkers, *_defaultChecker, *_available_by_default, *NoProxy;
 static PyObject *Proxy, *getSecurityPolicy, *queryInteraction, *CheckerPublic;
 static PyObject *ForbiddenAttribute, *Unauthorized;
 
@@ -143,9 +143,9 @@
 
   if (operator)
     {
-/*         elif name in _always_available: */
+/*         elif name in _available_by_default: */
 /*             return */
-      int ic = PySequence_Contains(_always_available, name);
+      int ic = PySequence_Contains(_available_by_default, name);
       if (ic < 0)
         return -1;
       if (ic)
@@ -581,7 +581,7 @@
   if (CheckerPublic == NULL) return;
   Py_DECREF(m);
 
-  if ((_always_available = PyList_New(0)) == NULL) return;
+  if ((_available_by_default = PyList_New(0)) == NULL) return;
 
   m = Py_InitModule3("_zope_security_checker", module_methods,
                      "C optimizations for zope.security.checker");
@@ -594,7 +594,7 @@
   EXPORT(_checkers);
   EXPORT(NoProxy);
   EXPORT(_defaultChecker);
-  EXPORT(_always_available);
+  EXPORT(_available_by_default);
     
   Py_INCREF(&CheckerType);
   PyModule_AddObject(m, "Checker", (PyObject *)&CheckerType);

Modified: Zope3/trunk/src/zope/security/checker.py
===================================================================
--- Zope3/trunk/src/zope/security/checker.py	2004-07-13 16:17:33 UTC (rev 26452)
+++ Zope3/trunk/src/zope/security/checker.py	2004-07-13 16:27:24 UTC (rev 26453)
@@ -156,7 +156,7 @@
             else:
                 __traceback_supplement__ = (TracebackSupplement, object)
                 raise Unauthorized(name=name, permission=permission)
-        elif name in _always_available:
+        elif name in _available_by_default:
             return
 
         if name != '__iter__' or hasattr(object, name):
@@ -236,7 +236,7 @@
 d['__reduce__'] = CheckerPublic
 del d
 
-# XXX It's a bit scary above that we can pickle a proxy if access is
+# TODO: It's a bit scary above that we can pickle a proxy if access is
 # granted to __reduce__. We might want to bother to prevent this in
 # general and only allow it in this specific case.
 
@@ -308,7 +308,7 @@
     # we can't use the type.  OTOH, we might not be able to use the
     # __class__ either, since not everything has one.
 
-    # XXX we really need formal proxy introspection
+    # TODO: we really need formal proxy introspection
 
     #if type(object) is Proxy:
     #    # Is this already a security proxy?
@@ -363,7 +363,7 @@
 _checkers = {}
 
 _defaultChecker = Checker({})
-_always_available = []
+_available_by_default = []
 
 # Get optimized versions
 try:
@@ -374,7 +374,7 @@
     from zope.security._zope_security_checker import _checkers, selectChecker
     from zope.security._zope_security_checker import NoProxy, Checker
     from zope.security._zope_security_checker import _defaultChecker
-    from zope.security._zope_security_checker import _always_available
+    from zope.security._zope_security_checker import _available_by_default
     zope.interface.classImplements(Checker, INameBasedChecker)
 
 
@@ -449,7 +449,7 @@
         try:
             super(CheckerLoggingMixin, self).check(object, name)
             if self.verbosity > 1:
-                if name in _always_available:
+                if name in _available_by_default:
                     print >> sys.stderr, (
                         '[CHK] + Always available: %s on %r' % (name, object))
                 else:
@@ -468,7 +468,7 @@
         try:
             super(CheckerLoggingMixin, self).check(object, name)
             if self.verbosity > 1:
-                if name in _always_available:
+                if name in _available_by_default:
                     print >> sys.stderr, (
                         '[CHK] + Always available getattr: %s on %r'
                         % (name, object))
@@ -510,12 +510,12 @@
 def _instanceChecker(inst):
     checker = _checkers.get(inst.__class__, _defaultChecker)
     if checker is _defaultChecker and isinstance(inst, Exception):
-        return NoProxy # XXX we should be more careful
+        return NoProxy # TODO: we should be more careful
     return checker
 
 def _classChecker(class_):
     if issubclass(class_, Exception):
-        return NoProxy  # XXX we should be more careful
+        return NoProxy  # TODO: we should be more careful
 
     return _typeChecker
 
@@ -523,15 +523,12 @@
     return _checkers.get(module)
 
 
-# The variable '_always_available' should really be called
-# '_available_by_default', as that would better reflect its meaning.
-# XXX: Fix the name.
-_always_available [:] = ['__lt__', '__le__', '__eq__',
-                         '__gt__', '__ge__', '__ne__',
-                         '__hash__', '__nonzero__',
-                         '__class__', '__providedBy__', '__implements__',
-                         '__repr__', '__conform__',
-                         ]
+_available_by_default[:] = ['__lt__', '__le__', '__eq__',
+                            '__gt__', '__ge__', '__ne__',
+                            '__hash__', '__nonzero__',
+                            '__class__', '__providedBy__', '__implements__',
+                            '__repr__', '__conform__',
+                            ]
 
 _callableChecker = NamesChecker(['__str__', '__name__', '__call__'])
 _typeChecker = NamesChecker(
@@ -632,7 +629,7 @@
     type(Interface): InterfaceChecker(
         IInterface,
         __str__=CheckerPublic, _implied=CheckerPublic, subscribe=CheckerPublic,
-        # XXX Backward:
+        # TODO: Backward:
         isImplementedByInstancesOf=CheckerPublic,
         isImplementedBy=CheckerPublic,
         ),



More information about the Zope3-Checkins mailing list