Re: [csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Ben Walton
Excerpts from Maciej Bliziński's message of Fri Apr 22 19:02:36 -0400 2011: > LGTM Ok, here's a pull request then since this branch isn't yet public. The http-auth branch in ~bwalton/opencsw-git contains the commit. Thanks -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416

Re: [csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Maciej Bliziński
2011/4/22 Ben Walton : > Before asking the user for a password to submit their package, look > for it in /etc/opt/csw/releases/auth/$username.  Fall back to getpass > on if there is any IOError while reading from the file. > > Signed-off-by: Ben Walton > --- >  gar/v2/lib/python/csw_upload_pkg.py

[csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Ben Walton
Before asking the user for a password to submit their package, look for it in /etc/opt/csw/releases/auth/$username. Fall back to getpass on if there is any IOError while reading from the file. Signed-off-by: Ben Walton --- gar/v2/lib/python/csw_upload_pkg.py | 11 ++- 1 files changed,

Re: [csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Maciej Bliziński
2011/4/22 Ben Walton : > Excerpts from Ben Walton's message of Fri Apr 22 08:10:23 -0400 2011: > >> +    password = getpass.getpass("{0}'s pkg release password> >> ".format(username)) > > FYI, this bug in python is annoying. :( > > http://bugs.python.org/issue11236 Yes, annoying indeed. There we

Re: [csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Ben Walton
Excerpts from Ben Walton's message of Fri Apr 22 08:10:23 -0400 2011: > +password = getpass.getpass("{0}'s pkg release password> > ".format(username)) FYI, this bug in python is annoying. :( http://bugs.python.org/issue11236 Thanks -Ben -- Ben Walton Systems Programmer - CHASS University o

Re: [csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Maciej Bliziński
2011/4/22 Ben Walton : >> To get the password, you can: >> >> password = af.read() # reads the whole file >> >> and with stripping: >> >> password = af.read().strip() >> >> (strips ws from both sides) > > Do we want that though?  It shouldn't hurt, but it also shouldn't be > necessary.  I'm only lo

[csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Ben Walton
Before asking the user for a password to submit their package, look for it in /etc/opt/csw/releases/auth/$username. Fall back to getpass on any exception. Signed-off-by: Ben Walton --- gar/v2/lib/python/csw_upload_pkg.py | 11 ++- 1 files changed, 10 insertions(+), 1 deletions(-) dif

Re: [csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-22 Thread Ben Walton
Excerpts from Maciej Bliziński's message of Fri Apr 22 02:03:34 -0400 2011: > 2011/4/22 Ben Walton : > > +  try: > > +    af = open(authfile, 'r') > > +    password = af.readline().rstrip() > > Try using the 'with' syntax: > > try: > with open(authfile, 'r') as af: > password = af... Ah, o

Re: [csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-21 Thread Maciej Bliziński
2011/4/22 Ben Walton : > +  try: > +    af = open(authfile, 'r') > +    password = af.readline().rstrip() Try using the 'with' syntax: try: with open(authfile, 'r') as af: password = af... To get the password, you can: password = af.read() # reads the whole file and with stripping: pass

[csw-devel] [PATCH] Add support for reading password from a file by default

2011-04-21 Thread Ben Walton
Before asking the user for a password to submit their package, look for it in /etc/opt/csw/releases/auth/$username. Fall back to getpass on any exception. Signed-off-by: Ben Walton --- gar/v2/lib/python/csw_upload_pkg.py | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff