Opened 12 years ago

Last modified 12 years ago

#298 closed defect (FIXED)

./bin/gmg adduser should take password, email as arguments, and prompt if not provided

Reported by: Christopher Allan Webber Owned by: Manolinux aka Mu
Priority: minor Milestone: 0.2.0
Component: programming Keywords:
Cc: Parent Tickets:


Instead of being sequential arguments, email and password (or at
least password) should be --keyword arguments. If not provided, we
should prompt the user for them (and obscure the password as being

This is a fairly easy and entry level task.

Change History (5)

comment:1 by Manolinux aka Mu, 12 years ago

Owner: set to Manolinux aka Mu
Status: NewIn Progress
I pick this one, if you don't mind.

It was indeed, very instructive. I am also enabling short options,
like that:


    optional arguments:
      -h, --help            show this help message and exit
      --username USERNAME, -u USERNAME
                            Username used to login
      --password PASSWORD, -p PASSWORD
                            Your supersecret word to login, beware: it could be
                            stored in your bash history
      --email EMAIL, -e EMAIL
                            Email to recieve notifications

since writing full options is quite tedious.

comment:2 by Manolinux aka Mu, 12 years ago

Status: In ProgressFeedback

[\ :sub:`manolinux/mediagoblin/manolinuxs-mediagoblin](`\ manolinux/mediagoblin/manolinuxs-mediagoblin)
Branch: 645\_gmg\_adduser\_prompt


-  I created a function in ```` '``prompt_if_not_set``' (I
   don't know if it would be the correct location).
-  I used ``raw_input`` for clear text and ``getpass.getpass`` for
-  Maybe, I could make more checks on input (empty username,
   lengths, and so).

comment:3 by Christopher Allan Webber, 12 years ago

Status: FeedbackClosed
Merged! Thanks so much :)

BTW, I made a few adjustments:
` <>`_

FYI for in the future:

-  It would be helpful to make your code compliant to PEP-8. It
   really helps keep code consistent and thus more readable:
   ` <>`_
-  Also, not a big deal, but I saw you did None.. I generally find
   that if you're doing a comparison to None rather than to False,
   maybe you mean "is None"... "is None" will make sure it's None, "
   None" is the same basically as "== False" iirc. Could be wrong
-  Lastly, if you do string operations, best to do stuff like

   foo + u"bleh"

instead of


    foo + "bleh" 

This just helps us avoid some unicode decoding issues :)

Thanks much! Great work :)

comment:4 by Manolinux aka Mu, 12 years ago

Great, thanks.

I'm new to python, so I will take your advices in much
consideration :)

comment:5 by Will Kahn-Greene, 12 years ago

The original url for this bug was .

Note: See TracTickets for help on using tickets.