[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security - _Proxy.c:1.1.2.4
Guido van Rossum
guido@python.org
Thu, 18 Apr 2002 14:00:20 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Security
In directory cvs.zope.org:/tmp/cvs-serv30842
Modified Files:
Tag: SecurityProxy-branch
_Proxy.c
Log Message:
Add functions getObject and getChecker to pull the object and checker
out of the proxy. (Obviously, these functions should not be callable
from restricted mode, but we're not enforcing that here -- that's
restricted mode's responsibility.)
=== Zope3/lib/python/Zope/Security/_Proxy.c 1.1.2.3 => 1.1.2.4 ===
};
+static PyObject *
+module_getObject(PyObject *self, PyObject *arg)
+{
+ PyObject *result;
+
+ if (!Proxy_Check(arg)) {
+ PyErr_SetString(PyExc_TypeError,
+ "getObject argument must be a Proxy");
+ return NULL;
+ }
+ result = Proxy_GetObject(arg);
+ Py_INCREF(result);
+ return result;
+}
+
+static PyObject *
+module_getChecker(PyObject *self, PyObject *arg)
+{
+ PyObject *result;
+
+ if (!Proxy_Check(arg)) {
+ PyErr_SetString(PyExc_TypeError,
+ "getChecker argument must be a Proxy");
+ return NULL;
+ }
+ result = Proxy_GetChecker(arg);
+ Py_INCREF(result);
+ return result;
+}
+
static PyMethodDef
module_functions[] = {
+ {"getObject", module_getObject, METH_O, "get object from proxy"},
+ {"getChecker", module_getChecker, METH_O, "get checker from proxy"},
{NULL}
};