[Zope-dev] adduser command: give feedback about success

Maurits van Rees m.van.rees at zestsoftware.nl
Fri Jan 7 17:55:53 EST 2011


Hi all,

I saw that Hanno added an entry point in Zope2 to create a 
bin/addzope2user command, which does the same as the 'bin/zopectl 
adduser' command.

That got me thinking that I have always found it not very helpful that 
this command never gave feedback about whether the user addition was 
successful or not.  In standard Zope2 it should always work as the 
_doAddUser method in AccessControl simply overwrites an existing user. 
But with Plone or other systems using Products.PluggableAuthService 
nothing is done in this case and the script just stops, giving you no 
clue that it failed.

I propose to add this feedback.  This needs a few simple changes in 
Zope2/utilities, Zope2/Startup, AccessControl, 
Products.PluggableAuthService, and a few doctest fixes in Products.Five. 
  The change to Zope2/utilities/adduser.py would be this:

===================================================================
-    adduser(app, user, pwd)
+    result = adduser(app, user, pwd)
+    if result:
+        print "User %s created." % user
+    else:
+        print "Got no result back. User creation may have failed."
+        print "Maybe the user already exists and nothing is done then."
+        print "Or the implementation does not give info when it succeeds."
===================================================================

The wording leaves room for the current _doAddUser implementations that 
simply never return info.

Is it okay if I do this?

Should/may I backport this to Zope 2.13 and 2.12?


-- 
Maurits van Rees
Programmer, Zest Software



More information about the Zope-Dev mailing list