| */ |
*/ |
| #include <Python.h> |
#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 *Proxy, *getSecurityPolicy, *queryInteraction, *CheckerPublic; |
| static PyObject *ForbiddenAttribute, *Unauthorized; |
static PyObject *ForbiddenAttribute, *Unauthorized; |
| |
|
| |
|
| if (operator) |
if (operator) |
| { |
{ |
| /* elif name in _always_available: */ |
/* elif name in _available_by_default: */ |
| /* return */ |
/* return */ |
| int ic = PySequence_Contains(_always_available, name); |
int ic = PySequence_Contains(_available_by_default, name); |
| if (ic < 0) |
if (ic < 0) |
| return -1; |
return -1; |
| if (ic) |
if (ic) |
| if (CheckerPublic == NULL) return; |
if (CheckerPublic == NULL) return; |
| Py_DECREF(m); |
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, |
m = Py_InitModule3("_zope_security_checker", module_methods, |
| "C optimizations for zope.security.checker"); |
"C optimizations for zope.security.checker"); |
| EXPORT(_checkers); |
EXPORT(_checkers); |
| EXPORT(NoProxy); |
EXPORT(NoProxy); |
| EXPORT(_defaultChecker); |
EXPORT(_defaultChecker); |
| EXPORT(_always_available); |
EXPORT(_available_by_default); |
| |
|
| Py_INCREF(&CheckerType); |
Py_INCREF(&CheckerType); |
| PyModule_AddObject(m, "Checker", (PyObject *)&CheckerType); |
PyModule_AddObject(m, "Checker", (PyObject *)&CheckerType); |