Commit 23ac3cc5 authored by Tres Seaver's avatar Tres Seaver

     - AccessControl.User used a misleading string exeception,
       'NotImplemented', which shadowed the Python builtin.
parent 3be3be21
...@@ -33,6 +33,10 @@ Zope Changes ...@@ -33,6 +33,10 @@ Zope Changes
(such as storages, databases, or logging handlers) to be used. (such as storages, databases, or logging handlers) to be used.
Bugs fixed Bugs fixed
- AccessControl.User used a misleading string exeception,
'NotImplemented', which shadowed the Python builtin.
- Collector #426: Inconsistent, undocumented error() method. - Collector #426: Inconsistent, undocumented error() method.
- Collector #799: Eliminate improper uses of SCRIPT_NAME. - Collector #799: Eliminate improper uses of SCRIPT_NAME.
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
############################################################################## ##############################################################################
"""Access control package""" """Access control package"""
__version__='$Revision: 1.179 $'[11:-2] __version__='$Revision: 1.180 $'[11:-2]
import Globals, socket, SpecialUsers,re import Globals, socket, SpecialUsers,re
import os import os
...@@ -32,7 +32,6 @@ from AccessControl.SecurityManagement import noSecurityManager ...@@ -32,7 +32,6 @@ from AccessControl.SecurityManagement import noSecurityManager
from AccessControl.ZopeSecurityPolicy import _noroles from AccessControl.ZopeSecurityPolicy import _noroles
ListType=type([]) ListType=type([])
NotImplemented='NotImplemented'
_marker=[] _marker=[]
...@@ -61,11 +60,11 @@ class BasicUser(Implicit): ...@@ -61,11 +60,11 @@ class BasicUser(Implicit):
return 1 return 1
def __init__(self,name,password,roles,domains): def __init__(self,name,password,roles,domains):
raise NotImplemented raise NotImplementedError
def getUserName(self): def getUserName(self):
"""Return the username of a user""" """Return the username of a user"""
raise NotImplemented raise NotImplementedError
def getId(self): def getId(self):
"""Get the ID of the user. The ID can be used, at least from """Get the ID of the user. The ID can be used, at least from
...@@ -75,11 +74,11 @@ class BasicUser(Implicit): ...@@ -75,11 +74,11 @@ class BasicUser(Implicit):
def _getPassword(self): def _getPassword(self):
"""Return the password of the user.""" """Return the password of the user."""
raise NotImplemented raise NotImplementedError
def getRoles(self): def getRoles(self):
"""Return the list of roles assigned to a user.""" """Return the list of roles assigned to a user."""
raise NotImplemented raise NotImplementedError
def getRolesInContext(self, object): def getRolesInContext(self, object):
"""Return the list of roles assigned to the user, """Return the list of roles assigned to the user,
...@@ -112,7 +111,7 @@ class BasicUser(Implicit): ...@@ -112,7 +111,7 @@ class BasicUser(Implicit):
def getDomains(self): def getDomains(self):
"""Return the list of domain restrictions for a user""" """Return the list of domain restrictions for a user"""
raise NotImplemented raise NotImplementedError
# ------------------------------ # ------------------------------
# Internal User object interface # Internal User object interface
...@@ -479,15 +478,15 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager, ...@@ -479,15 +478,15 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
def getUserNames(self): def getUserNames(self):
"""Return a list of usernames""" """Return a list of usernames"""
raise NotImplemented raise NotImplementedError
def getUsers(self): def getUsers(self):
"""Return a list of user objects""" """Return a list of user objects"""
raise NotImplemented raise NotImplementedError
def getUser(self, name): def getUser(self, name):
"""Return the named user object or None""" """Return the named user object or None"""
raise NotImplemented raise NotImplementedError
def getUserById(self, id, default=_marker): def getUserById(self, id, default=_marker):
"""Return the user corresponding to the given id. """Return the user corresponding to the given id.
...@@ -505,19 +504,19 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager, ...@@ -505,19 +504,19 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
do the actual adding of a user. The 'password' will be the do the actual adding of a user. The 'password' will be the
original input password, unencrypted. The implementation of this original input password, unencrypted. The implementation of this
method is responsible for performing any needed encryption.""" method is responsible for performing any needed encryption."""
raise NotImplemented raise NotImplementedError
def _doChangeUser(self, name, password, roles, domains, **kw): def _doChangeUser(self, name, password, roles, domains, **kw):
"""Modify an existing user. This should be implemented by subclasses """Modify an existing user. This should be implemented by subclasses
to make the actual changes to a user. The 'password' will be the to make the actual changes to a user. The 'password' will be the
original input password, unencrypted. The implementation of this original input password, unencrypted. The implementation of this
method is responsible for performing any needed encryption.""" method is responsible for performing any needed encryption."""
raise NotImplemented raise NotImplementedError
def _doDelUsers(self, names): def _doDelUsers(self, names):
"""Delete one or more users. This should be implemented by subclasses """Delete one or more users. This should be implemented by subclasses
to do the actual deleting of users.""" to do the actual deleting of users."""
raise NotImplemented raise NotImplementedError
# As of Zope 2.5, userFolderAddUser, userFolderEditUser and # As of Zope 2.5, userFolderAddUser, userFolderEditUser and
# userFolderDelUsers offer aliases for the the _doAddUser, _doChangeUser # userFolderDelUsers offer aliases for the the _doAddUser, _doChangeUser
...@@ -534,7 +533,7 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager, ...@@ -534,7 +533,7 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
objects.""" objects."""
if hasattr(self, '_doAddUser'): if hasattr(self, '_doAddUser'):
return self._doAddUser(name, password, roles, domains, **kw) return self._doAddUser(name, password, roles, domains, **kw)
raise NotImplemented raise NotImplementedError
def userFolderEditUser(self, name, password, roles, domains, **kw): def userFolderEditUser(self, name, password, roles, domains, **kw):
"""API method for changing user object attributes. Note that not """API method for changing user object attributes. Note that not
...@@ -542,14 +541,14 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager, ...@@ -542,14 +541,14 @@ class BasicUserFolder(Implicit, Persistent, Navigation, Tabs, RoleManager,
attributes.""" attributes."""
if hasattr(self, '_doChangeUser'): if hasattr(self, '_doChangeUser'):
return self._doChangeUser(name, password, roles, domains, **kw) return self._doChangeUser(name, password, roles, domains, **kw)
raise NotImplemented raise NotImplementedError
def userFolderDelUsers(self, names): def userFolderDelUsers(self, names):
"""API method for deleting one or more user objects. Note that not """API method for deleting one or more user objects. Note that not
all user folder implementations support deletion of user objects.""" all user folder implementations support deletion of user objects."""
if hasattr(self, '_doDelUsers'): if hasattr(self, '_doDelUsers'):
return self._doDelUsers(names) return self._doDelUsers(names)
raise NotImplemented raise NotImplementedError
# ----------------------------------- # -----------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment