Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A script for retrieving user properties. Written to update Trac email…

…s from Plone/LDAP.

svn path=/plone.org/Products.PloneOrg/trunk/; revision=47995
  • Loading branch information...
commit a1b0aa63597ebaf25086487f4da2e7e2584831d3 1 parent e9ed0b9
@rpatterson rpatterson authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 scripts/get_user_properties.py
View
22 scripts/get_user_properties.py
@@ -0,0 +1,22 @@
+"""When used as a script, this will print a comma separated list of
+property values corresponding to the properties given on the command
+line for each user named on stdin."""
+
+from Products.CMFCore.utils import getToolByName
+
+def getUserProperties(portal, usernames, properties):
+ """Return a sequence of property values for each user specified"""
+ for username in usernames:
+ username = username.strip()
+ acl_users = getToolByName(portal, 'acl_users')
+ user = acl_users.getUser(username)
+ yield tuple(user.getProperty(property, '') for property in properties)
+
+if __name__ == '__main__':
+ import sys
+ from Testing.makerequest import makerequest
+
+ app = makerequest(app)
+ portal = app['plone.org']
+ for properties in getUserProperties(portal, sys.stdin, sys.argv[1:]):
+ print ', '.join(properties)
Please sign in to comment.
Something went wrong with that request. Please try again.