r656 - in zope-groupuserfolder/trunk: . debian tests
Fabio Tranchitella
kobold at alioth.debian.org
Fri Feb 9 15:42:24 CET 2007
Author: kobold
Date: 2007-02-09 15:42:24 +0100 (Fri, 09 Feb 2007)
New Revision: 656
Modified:
zope-groupuserfolder/trunk/CHANGES
zope-groupuserfolder/trunk/GRUFUser.py
zope-groupuserfolder/trunk/GroupUserFolder.py
zope-groupuserfolder/trunk/GroupsTool.py
zope-groupuserfolder/trunk/Log.py
zope-groupuserfolder/trunk/debian/changelog
zope-groupuserfolder/trunk/global_symbols.py
zope-groupuserfolder/trunk/tests/Log.py
zope-groupuserfolder/trunk/tests/testGroupUserFolderAPI.py
zope-groupuserfolder/trunk/tests/testLDAPGroupFolder.py
zope-groupuserfolder/trunk/tests/testLDAPUserFolder.py
zope-groupuserfolder/trunk/version.txt
Log:
New upstream release.
Modified: zope-groupuserfolder/trunk/CHANGES
===================================================================
--- zope-groupuserfolder/trunk/CHANGES 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/CHANGES 2007-02-09 14:42:24 UTC (rev 656)
@@ -1,3 +1,7 @@
+Unreleased
+ * Got rid of zLOG in favor of logging.
+ [stefan]
+
v3.54 - 2006-09-19
* Fix a bug with LDAPUserFolder where another UserFolder was returned when LUF
was requested [jvloothuis]
Modified: zope-groupuserfolder/trunk/GRUFUser.py
===================================================================
--- zope-groupuserfolder/trunk/GRUFUser.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/GRUFUser.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -20,9 +20,11 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: GRUFUser.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: GRUFUser.py 34723 2006-12-15 11:25:30Z encolpe $
__docformat__ = 'restructuredtext'
+from copy import copy
+
# fakes a method from a DTML File
from Globals import MessageDialog, DTMLFile
@@ -797,12 +799,12 @@
def _getMemberIds(self, users = 1, groups = 1, transitive = 1, ):
"""
- Return the member ids (users and groups) of the atoms of this group.
- Transitiveness attribute is ignored with LDAP (no nested groups with
- LDAP anyway).
- This method now uses a shortcut to fetch members of an LDAP group
- (stored either within Zope or within your LDAP server)
- """
+ Return the member ids (users and groups) of the atoms of this group.
+ Transitiveness attribute is ignored with LDAP (no nested groups with
+ LDAP anyway).
+ This method now uses a shortcut to fetch members of an LDAP group
+ (stored either within Zope or within your LDAP server)
+ """
# Initial parameters.
# We fetch the users/groups list depending on what we search,
# and carefuly avoiding to use LDAP sources.
@@ -840,7 +842,10 @@
groupid = self.getId()
for src in ldap_sources:
groups = src.getGroups()
- grp = [ group for group in groups if group[0] == self.getId() ]
+ # With LDAPUserFolder >= 2.7 we need to add GROUP_PREFIX to group_name
+ # We keep backward compatibility
+ grp = [ group for group in groups if group[0] == self.getId() or \
+ GROUP_PREFIX + group[0] == self.getId()]
if not grp:
Log(LOG_DEBUG, "No such group ('%s') found." % (groupid,))
continue
@@ -875,13 +880,6 @@
gruf = self.aq_parent
return id in gruf.getMemberIds(self.getId())
- security.declarePrivate("setMembers")
- def setMembers(self, userids):
- """Set the members of the group
- """
- for userid in userids:
- self.aq_parent.userFolderAddGroup(userid, groupid)
-
security.declarePrivate("addMember")
def addMember(self, userid):
"""Add a user the the current group"""
@@ -915,6 +913,20 @@
gruf._updateUser(userid, groups = groups)
else:
raise ValueError, "User '%s' doesn't belong to group '%s'" % (userid, groupid, )
+
+ security.declarePrivate("setMembers")
+ def setMembers(self, userids):
+ """Set the members of the group
+ """
+ member_ids = self.getMemberIds()
+ all_ids = copy(member_ids)
+ all_ids.extend(userids)
+ groupid = self.getId()
+ for id in all_ids:
+ if id in member_ids and id not in userids:
+ self.removeMember(id)
+ elif id not in member_ids and id in userids:
+ self.addMember(id)
InitializeClass(GRUFUser)
Modified: zope-groupuserfolder/trunk/GroupUserFolder.py
===================================================================
--- zope-groupuserfolder/trunk/GroupUserFolder.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/GroupUserFolder.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -20,7 +20,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: GroupUserFolder.py 30517 2006-09-18 13:44:54Z manuco $
+# $Id: GroupUserFolder.py 34725 2006-12-15 12:27:06Z encolpe $
__docformat__ = 'restructuredtext'
@@ -1346,7 +1346,7 @@
"""
getGRUFVersion(self,) => Return human-readable GRUF version as a string.
"""
- rev_date = "$Date: 2006-09-18 15:44:54 +0200 (lun, 18 sep 2006) $"[7:-2]
+ rev_date = "$Date: 2006-12-15 13:27:06 +0100 (ven, 15 déc 2006) $"[7:-2]
return "%s / Revised %s" % (version__, rev_date)
@@ -2558,9 +2558,9 @@
if "acl_users" in us.objectIds():
us.manage_delObjects(['acl_users'])
-## # If we use ldap, tag it
-## if string.find(new_factory.lower(), "ldap") > -1:
-## self._haveLDAPUF += 1
+ ## If we use ldap, tag it
+ #if string.find(new_factory.lower(), "ldap") > -1:
+ # self._haveLDAPUF += 1
# Re-create the underlying UserFolder
# If we're called TTW, uses a redirect else tries to call the UF factory directly
Modified: zope-groupuserfolder/trunk/GroupsTool.py
===================================================================
--- zope-groupuserfolder/trunk/GroupsTool.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/GroupsTool.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -24,7 +24,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: GroupsTool.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: GroupsTool.py 33400 2006-11-11 11:59:47Z shh42 $
__docformat__ = 'restructuredtext'
from Products.CMFCore.utils import UniqueObject
@@ -35,6 +35,7 @@
from Acquisition import aq_base
from AccessControl.User import nobody
from AccessControl import ClassSecurityInfo
+from ZODB.POSException import ConflictError
# BBB CMF < 1.5
try:
from Products.CMFCore.permissions import ManagePortal
@@ -478,16 +479,12 @@
#log("wrapping group %s" % g)
portal_group = gd.wrapGroup(g)
return portal_group
-
+ except ConflictError:
+ raise
except:
- from zLOG import LOG, ERROR
- import sys
- type,value,tb = sys.exc_info()
- try:
- LOG('GroupsTool', ERROR, 'Error during wrapGroup:', "\nType:%s\nValue:%s\n" % (type,value))
- finally:
- tb = None # Avoid leaking frame
- pass
+ import logging
+ logger = logging.getLogger('GroupUserFolder.GroupsTool')
+ logger.exception('Error during wrapGroup')
# Failed.
return g
Modified: zope-groupuserfolder/trunk/Log.py
===================================================================
--- zope-groupuserfolder/trunk/Log.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/Log.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -37,7 +37,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: Log.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: Log.py 33389 2006-11-11 11:24:41Z shh42 $
__docformat__ = 'restructuredtext'
@@ -152,22 +152,26 @@
LOG_OUTPUT.flush()
-import zLOG
+import logging
+CUSTOM_TRACE = 5
+logging.addLevelName('TRACE', CUSTOM_TRACE)
+
zLogLevelConverter = {
- LOG_NONE: zLOG.TRACE,
- LOG_CRITICAL: zLOG.PANIC,
- LOG_ERROR: zLOG.ERROR,
- LOG_WARNING: zLOG.PROBLEM,
- LOG_NOTICE: zLOG.INFO,
- LOG_DEBUG: zLOG.DEBUG,
+ LOG_NONE: CUSTOM_TRACE,
+ LOG_CRITICAL: logging.CRITICAL,
+ LOG_ERROR: logging.ERROR,
+ LOG_WARNING: logging.WARNING,
+ LOG_NOTICE: logging.INFO,
+ LOG_DEBUG: logging.DEBUG,
}
def LogzLog(level, label, data, ):
"""
LogzLog : writes data though Zope's logging facility
"""
- zLOG.LOG("IngeniWeb", zLogLevelConverter[level], "", data + "\n", )
+ logger = logging.getLogger('GroupUserFolder')
+ logger.log(zLogLevelConverter[level], data + "\n", )
Modified: zope-groupuserfolder/trunk/debian/changelog
===================================================================
--- zope-groupuserfolder/trunk/debian/changelog 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/debian/changelog 2007-02-09 14:42:24 UTC (rev 656)
@@ -1,3 +1,9 @@
+zope-groupuserfolder (3.54.1-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Fabio Tranchitella <kobold at debian.org> Fri, 9 Feb 2007 15:42:15 +0100
+
zope-groupuserfolder (3.54-1) unstable; urgency=low
* New upstream release.
Modified: zope-groupuserfolder/trunk/global_symbols.py
===================================================================
--- zope-groupuserfolder/trunk/global_symbols.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/global_symbols.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -20,7 +20,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: global_symbols.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: global_symbols.py 32384 2006-10-27 10:00:55Z encolpe $
__docformat__ = 'restructuredtext'
import os
@@ -28,7 +28,7 @@
# Check if we have to be in debug mode
import Log
-if os.path.isfile(os.path.abspath(os.path.dirname(__file__)) + '/debug.txt'):
+if os.path.isfile(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'debug.txt')):
Log.LOG_LEVEL = Log.LOG_DEBUG
DEBUG_MODE = 1
else:
@@ -38,8 +38,8 @@
from Log import *
# Retreive version
-if os.path.isfile(os.path.abspath(os.path.dirname(__file__)) + '/version.txt'):
- __version_file_ = open(os.path.abspath(os.path.dirname(__file__)) + '/version.txt', 'r', )
+if os.path.isfile(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'version.txt')):
+ __version_file_ = open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'version.txt'), 'r', )
version__ = __version_file_.read()[:-1]
__version_file_.close()
else:
Modified: zope-groupuserfolder/trunk/tests/Log.py
===================================================================
--- zope-groupuserfolder/trunk/tests/Log.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/tests/Log.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -37,7 +37,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: Log.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: Log.py 33402 2006-11-11 12:26:18Z shh42 $
__docformat__ = 'restructuredtext'
@@ -151,25 +151,28 @@
LOG_OUTPUT.write(data+'\n')
LOG_OUTPUT.flush()
-
logFile = LogFile
-import zLOG
+import logging
+CUSTOM_TRACE = 5
+logging.addLevelName('TRACE', CUSTOM_TRACE)
+
zLogLevelConverter = {
- LOG_NONE: zLOG.TRACE,
- LOG_CRITICAL: zLOG.PANIC,
- LOG_ERROR: zLOG.ERROR,
- LOG_WARNING: zLOG.PROBLEM,
- LOG_NOTICE: zLOG.INFO,
- LOG_DEBUG: zLOG.DEBUG,
+ LOG_NONE: CUSTOM_TRACE,
+ LOG_CRITICAL: logging.CRITICAL,
+ LOG_ERROR: logging.ERROR,
+ LOG_WARNING: logging.WARNING,
+ LOG_NOTICE: logging.INFO,
+ LOG_DEBUG: logging.DEBUG,
}
def LogzLog(level, label, data, ):
"""
LogzLog : writes data though Zope's logging facility
"""
- zLOG.LOG("IngeniWeb", zLogLevelConverter[level], "", data + "\n", )
+ logger = logging.getLogger('GroupUserFolder')
+ logger.log(zLogLevelConverter[level], data + "\n", )
Modified: zope-groupuserfolder/trunk/tests/testGroupUserFolderAPI.py
===================================================================
--- zope-groupuserfolder/trunk/tests/testGroupUserFolderAPI.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/tests/testGroupUserFolderAPI.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -20,7 +20,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: testGroupUserFolderAPI.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: testGroupUserFolderAPI.py 34723 2006-12-15 11:25:30Z encolpe $
__docformat__ = 'restructuredtext'
import os, sys
@@ -771,9 +771,6 @@
)
# Groups support
- def test_setMembers(self):
- """Set the members of the group
- """
def test_getMemberIds(self,):
should_be = [
@@ -829,13 +826,29 @@
def test_removeMember(self):
"""Remove a member from a group
- """
+ """
self.failUnless("u1" not in self.gruf.getMemberIds("ng3"))
self.gruf.addMember("ng3", "u1")
self.failUnless("u1" in self.gruf.getMemberIds("ng3"))
self.gruf.removeMember("ng3", "u1")
self.failUnless("u1" not in self.gruf.getMemberIds("ng3"))
+ def test_setMembers(self):
+ """Set the members of the group
+ """
+ member_ids = self.gruf.getMemberIds("ng3")
+ self.gruf.addMember("ng3", "u1")
+ self.gruf.addMember("ng3", "u2")
+ self.failIf("u1" not in self.gruf.getMemberIds("ng3"))
+ self.failIf("u2" not in self.gruf.getMemberIds("ng3"))
+ self.failIf("u3" in self.gruf.getMemberIds("ng3"))
+
+ self.gruf.setMembers("ng3", (member_ids + ["u2", "u3"]))
+
+ self.failIf("u1" in self.gruf.getMemberIds("ng3"))
+ self.failIf("u2" not in self.gruf.getMemberIds("ng3"))
+ self.failIf("u3" not in self.gruf.getMemberIds("ng3"))
+
def test_hasMember(self,):
self.failUnless(not self.gruf.hasMember("ng3", "u1"))
self.failUnless(not self.gruf.hasMember("group_ng3", "u1"))
Modified: zope-groupuserfolder/trunk/tests/testLDAPGroupFolder.py
===================================================================
--- zope-groupuserfolder/trunk/tests/testLDAPGroupFolder.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/tests/testLDAPGroupFolder.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -20,7 +20,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: testLDAPGroupFolder.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: testLDAPGroupFolder.py 34725 2006-12-15 12:27:06Z encolpe $
__docformat__ = 'restructuredtext'
import os, sys
@@ -122,23 +122,6 @@
# User source replacement
self.gruf.replaceUserSource("Users",
"manage_addProduct/LDAPUserFolder/manage_addLDAPUserFolder",
- title = dg('title'),
- LDAP_server = dg('server'),
- login_attr = dg('login_attr'),
- uid_attr = dg('uid_attr'),
- users_base = dg('users_base'),
- users_scope = dg('users_scope'),
- roles= dg('roles'),
- groups_base = dg('groups_base'),
- groups_scope = dg('groups_scope'),
- binduid = dg('binduid'),
- bindpwd = dg('bindpwd'),
- binduid_usage = dg('binduid_usage'),
- rdn_attr = dg('rdn_attr'),
- local_groups = dg('local_groups'),
- encryption = dg('encryption'),
- use_ssl = dg('use_ssl'),
- read_only=dg('read_only'),
)
self.gruf.replaceUserSource(
"Groups",
@@ -150,6 +133,7 @@
# Edit LDAPUF 'cause objectClass cannot be set otherwise :(
self.gruf.Users.acl_users.manage_edit(
title = dg('title'),
+ #LDAP_server = dg('server'),
login_attr = dg('login_attr'),
uid_attr = dg('uid_attr'),
users_base = dg('users_base'),
@@ -162,9 +146,10 @@
bindpwd = dg('bindpwd'),
binduid_usage = dg('binduid_usage'),
rdn_attr = dg('rdn_attr'),
- local_groups = 0,
+ local_groups = dg('local_groups'),
encryption = dg('encryption'),
- read_only=dg('read_only'),
+ #use_ssl = dg('use_ssl'),
+ #read_only=dg('read_only'),
)
self.delete_created_users()
Modified: zope-groupuserfolder/trunk/tests/testLDAPUserFolder.py
===================================================================
--- zope-groupuserfolder/trunk/tests/testLDAPUserFolder.py 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/tests/testLDAPUserFolder.py 2007-02-09 14:42:24 UTC (rev 656)
@@ -20,7 +20,7 @@
"""
__version__ = "$Revision: $"
# $Source: $
-# $Id: testLDAPUserFolder.py 30098 2006-09-08 12:35:01Z encolpe $
+# $Id: testLDAPUserFolder.py 34725 2006-12-15 12:27:06Z encolpe $
__docformat__ = 'restructuredtext'
import os, sys
@@ -116,23 +116,23 @@
# User source replacement
self.gruf.replaceUserSource("Users",
"manage_addProduct/LDAPUserFolder/manage_addLDAPUserFolder",
- title = dg('title'),
- LDAP_server = dg('server'),
- login_attr = dg('login_attr'),
- uid_attr = dg('uid_attr'),
- users_base = dg('users_base'),
- users_scope = dg('users_scope'),
- roles= dg('roles'),
- groups_base = dg('groups_base'),
- groups_scope = dg('groups_scope'),
- binduid = dg('binduid'),
- bindpwd = dg('bindpwd'),
- binduid_usage = dg('binduid_usage'),
- rdn_attr = dg('rdn_attr'),
- local_groups = dg('local_groups'),
- encryption = dg('encryption'),
- use_ssl = dg('use_ssl'),
- read_only=dg('read_only'),
+ #title = dg('title'),
+ #LDAP_server = dg('server'),
+ #login_attr = dg('login_attr'),
+ #uid_attr = dg('uid_attr'),
+ #users_base = dg('users_base'),
+ #users_scope = dg('users_scope'),
+ #roles= dg('roles'),
+ #groups_base = dg('groups_base'),
+ #groups_scope = dg('groups_scope'),
+ #binduid = dg('binduid'),
+ #bindpwd = dg('bindpwd'),
+ #binduid_usage = dg('binduid_usage'),
+ #rdn_attr = dg('rdn_attr'),
+ #local_groups = dg('local_groups'),
+ #encryption = dg('encryption'),
+ #use_ssl = dg('use_ssl'),
+ #read_only=dg('read_only'),
)
# Edit LDAPUF 'cause objectClass cannot be set otherwise :(
Modified: zope-groupuserfolder/trunk/version.txt
===================================================================
--- zope-groupuserfolder/trunk/version.txt 2007-02-09 14:39:12 UTC (rev 655)
+++ zope-groupuserfolder/trunk/version.txt 2007-02-09 14:42:24 UTC (rev 656)
@@ -1 +1 @@
-3.54
\ No newline at end of file
+3.54.1
More information about the pkg-zope-commits
mailing list