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

Christian Theune ct at gocept.com
Sat Jan 8 13:38:13 EST 2011


On 01/07/2011 11:55 PM, Maurits van Rees wrote:
> 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?

Sounds bearable given what we have. :)

-- 
Christian Theune · ct at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1
Zope and Plone consulting and development


More information about the Zope-Dev mailing list