[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/security/
Backport of
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Aug 12 11:58:35 EDT 2004
Log message for revision 27055:
Backport of
------------------------------------------------------------------------
r26453 | srichter | 2004-07-13 12:27:24 -0400 (Tue, 13 Jul 2004) | 3
lines
Renamed _always_available to _available_by_default as hinted by a XXX.
You need to recompile Zope.
------------------------------------------------------------------------
Changed:
U Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c
U Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py
-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c 2004-08-12 15:54:16 UTC (rev 27054)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/_zope_security_checker.c 2004-08-12 15:58:34 UTC (rev 27055)
@@ -14,7 +14,7 @@
#include <Python.h>
-static PyObject *_checkers, *_defaultChecker, *_always_available, *NoProxy;
+static PyObject *_checkers, *_defaultChecker, *_available_by_default, *NoProxy;
static PyObject *Proxy, *thread_local, *CheckerPublic;
static PyObject *ForbiddenAttribute, *Unauthorized;
@@ -140,9 +140,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)
@@ -577,7 +577,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");
@@ -590,7 +590,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/branches/ZopeX3-3.0/src/zope/security/checker.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py 2004-08-12 15:54:16 UTC (rev 27054)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/checker.py 2004-08-12 15:58:34 UTC (rev 27055)
@@ -153,7 +153,7 @@
else:
__traceback_supplement__ = (TracebackSupplement, object)
raise Unauthorized(name, permission)
- elif name in _always_available:
+ elif name in _available_by_default:
return
if name != '__iter__' or hasattr(object, name):
@@ -233,7 +233,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.
@@ -305,7 +305,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?
@@ -357,7 +357,7 @@
_checkers = {}
_defaultChecker = Checker({})
-_always_available = []
+_available_by_default = []
# Get optimized versions
try:
@@ -368,7 +368,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)
@@ -443,7 +443,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:
@@ -462,7 +462,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))
@@ -508,15 +508,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(
@@ -608,7 +605,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