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

2011-01-10 Thread Maurits van Rees
Op 09-01-11 10:32, Marius Gedminas schreef:
 On Fri, Jan 07, 2011 at 11:55:53PM +0100, Maurits van Rees wrote:
 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.

 I don't suppose you could somehow change the API so the script can
 report something useful?  I don't even know if I succeeded or not
 sounds pretty pathetic.

Agreed.  But with current releases of Products.PluggableAuthService 
(until and including 1.7.2) no result is given back, so we cannot be 
sure here if there is no result because the PAS is too old or because it 
really failed.

With the proposed changes, either the created user or None is returned, 
which you might consider an API change.  At least I mention in the 
interface in AccessControl that implementations should return the 
created user or None.

 Maybe it's better than surly silence.

That's the general idea.

I committed the changes on Zope2 trunk and branch 2.13, AccessControl 
trunk, and Products.PluggableAuthService trunk (used by Plone 4.0 and 
4.1).  Note that Zope2 2.13 also uses AccessControl trunk and in fact 
there are no official branches of that.

Note that in the do_adduser method that is used in 'bin/zopectl adduser' 
I used shorter output as that code gets printed on the command line so 
it should be very simple.  It either prints Created user joe or 
Created user None.


Cheers,

-- 
Maurits van Rees
Programmer at Zest Software http://zestsoftware.nl
Personal website http://maurits.vanrees.org/

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


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

2011-01-09 Thread Hanno Schlichting
Hi.

On Fri, Jan 7, 2011 at 11:55 PM, Maurits van Rees
m.van.r...@zestsoftware.nl wrote:
 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.

Yeah, I put it back after I noticed it was really needed in a WSGI
environment. Tres added it in the original wsgi branch and I thought
it was a duplicate until recently.

 Is it okay if I do this?

Yep. We can maybe tweak the wording, but the intent is good ;)

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

I'd only do this in 2.13 and trunk. 2.12 is in a real late stage of
its life now, I'd like to keep changes in it to real bug fixes now.

Hanno
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


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

2011-01-08 Thread Christian Theune
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 · c...@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
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


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

2011-01-07 Thread Maurits van Rees
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

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )