[Zope-Checkins] CVS: Zope/lib/python/AccessControl - User.py:1.170.4.6 cAccessControl.c:1.17.4.1
Chris McDonough
chrism@zope.com
Fri, 3 Jan 2003 01:29:53 -0500
Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv26385
Modified Files:
Tag: chrism-install-branch
User.py cAccessControl.c
Log Message:
Merging chrism-install-branch with HEAD (hopefully for one of the last
times).
=== Zope/lib/python/AccessControl/User.py 1.170.4.5 => 1.170.4.6 ===
--- Zope/lib/python/AccessControl/User.py:1.170.4.5 Sun Nov 24 18:29:53 2002
+++ Zope/lib/python/AccessControl/User.py Fri Jan 3 01:29:20 2003
@@ -1034,7 +1034,7 @@
def _doChangeUser(self, name, password, roles, domains, **kw):
user=self.data[name]
if password is not None:
- if self.encrypt_passwords:
+ if self.encrypt_passwords and not self._isPasswordEncrypted(password):
password = self._encryptPassword(password)
user.__=password
user.roles=roles
=== Zope/lib/python/AccessControl/cAccessControl.c 1.17 => 1.17.4.1 ===
--- Zope/lib/python/AccessControl/cAccessControl.c:1.17 Tue Jul 23 10:08:55 2002
+++ Zope/lib/python/AccessControl/cAccessControl.c Fri Jan 3 01:29:20 2003
@@ -343,6 +343,8 @@
static PyObject *PermissionRole_of(PermissionRole *self, PyObject *args);
static void PermissionRole_dealloc(PermissionRole *self);
+static PyObject *PermissionRole_getattro(PermissionRole *self, PyObject *name);
+
static PyObject *imPermissionRole_of(imPermissionRole *self, PyObject *args);
static int imPermissionRole_length(imPermissionRole *self);
static PyObject *imPermissionRole_get(imPermissionRole *self,
@@ -370,6 +372,10 @@
PyObject *name);
static int SecurityManager_setattro(SecurityManager *self,
PyObject *name, PyObject *value);
+
+static getattrofunc ExtensionClassGetattro;
+
+
/*
** Constants
*/
@@ -547,7 +553,7 @@
NULL, /* tp_hash */
NULL, /* tp_call */
NULL, /* tp_str */
- NULL, /* tp_getattro */
+ (getattrofunc) PermissionRole_getattro, /* tp_getattro */
NULL, /* tp_setattro */
/* Reserved fields */
0, /* tp_xxx3 */
@@ -1530,6 +1536,42 @@
PyMem_DEL(self);
}
+
+/* for DocFinder */
+/*
+** PermissionRole_getattro
+**
+*/
+
+static PyObject *PermissionRole_getattro(PermissionRole *self, PyObject *name) {
+ PyObject *result= NULL;
+ char *name_s= PyString_AsString(name);
+
+ /* see whether we know the attribute */
+ /* we support both the old "_d" (from the Python implementation)
+ and the new "__roles__"
+ */
+ if (name_s[0] == '_') {
+ if (name_s[1] == '_') {
+ if (strcmp(name_s,"__name__") == 0)
+ result= self->__name__;
+ else if (strcmp(name_s,"__roles__") == 0)
+ result= self->__roles__;
+ }
+ else if (name_s[1] == 'p' && name_s[2] == 0)
+ result= self->_p;
+ else if (name_s[1] == 'd' && name_s[2] == 0)
+ result= self->__roles__;
+ }
+ if (result) {
+ Py_INCREF(result);
+ return result;
+ } else {
+ return ExtensionClassGetattro((PyObject *)self,name);
+ }
+}
+
+
/*
** imPermissionRole_of
**
@@ -2089,8 +2131,7 @@
ZopeSecurityPolicyType.tp_getattro =
(getattrofunc) PyExtensionClassCAPI->getattro;
- PermissionRoleType.tp_getattro =
- (getattrofunc) PyExtensionClassCAPI->getattro;
+ ExtensionClassGetattro= PyExtensionClassCAPI->getattro;
imPermissionRoleType.tp_getattro =
(getattrofunc) PyExtensionClassCAPI->getattro;