changeset 3:4f997989dfb1

account scripts: mostly cosmetic changes, remove unused code
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 21 Feb 2011 02:24:16 +0100
parents ca7580cd1f30
children 497a65401dcb
files MoinMoin/script/account/__init__.py MoinMoin/script/account/create.py MoinMoin/script/account/disable.py MoinMoin/script/account/resetpw.py moin
diffstat 5 files changed, 29 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/account/__init__.py	Sun Feb 20 21:44:35 2011 +0100
+++ b/MoinMoin/script/account/__init__.py	Mon Feb 21 02:24:16 2011 +0100
@@ -1,14 +1,7 @@
 # -*- coding: iso-8859-1 -*-
 """
-    MoinMoin - User Accounts Script Package
+    MoinMoin - User Accounts Management Scripts
 
-    @copyright: 2006 MoinMoin:ThomasWaldmann
+    @copyright: 2006,2011 MoinMoin:ThomasWaldmann
     @license: GNU GPL, see COPYING for details.
 """
-
-from MoinMoin.util import pysupport
-
-# create a list of extension scripts from the subpackage directory
-account_scripts = pysupport.getPackageModules(__file__)
-modules = account_scripts
-
--- a/MoinMoin/script/account/create.py	Sun Feb 20 21:44:35 2011 +0100
+++ b/MoinMoin/script/account/create.py	Mon Feb 21 02:24:16 2011 +0100
@@ -2,36 +2,31 @@
 """
 MoinMoin - create a user account
 
-TODO: Currently works on unprotected user backend
-
 @copyright: 2006 MoinMoin:ThomasWaldmann,
             2011 MoinMoin:ReimarBauer
 @license: GNU GPL, see COPYING for details.
 """
+
 from flask import flaskg
 from flask import current_app as app
 from flaskext.script import Command, Option
+
 from MoinMoin import user
 
 
 class Create_User(Command):
-    description = 'This command allows you to create user accounts'
+    description = 'This command allows you to create a user account'
     option_list = (
         Option('--name', '-n', required=True, dest='name', type=unicode,
-               help="Set the wiki user name to NAME."
-               ),
+               help="Set the wiki user name to NAME."),
         Option('--alias', '-a', required=False, dest="aliasname", type=unicode,
-               help="Set the wiki user alias name to ALIAS (e.g. the real name if NAME is cryptic)."
-               ),
+               help="Set the wiki user alias name to ALIAS (e.g. the real name if NAME is cryptic)."),
         Option('--email', '-e', required=True, dest='email', type=unicode,
-               help="Set the user's email address to EMAIL."
-               ),
+               help="Set the user's email address to EMAIL."),
         Option('--openid', '-o', required=False, dest='openid', type=unicode,
-               help="Set the user's openid address."
-               ),
+               help="Set the user's openid address."),
         Option('--password', '-p', required=True, dest="password", type=unicode,
-               help="Set the user's password to PASSWORD."
-               )
+               help="Set the user's password to PASSWORD."),
     )
 
     def run(self, name, aliasname, email, openid, password):
@@ -48,4 +43,3 @@
             u = user.User(uid)
             print " %-20s %-25s %-35s - created." % (u.id, u.name, u.email),
 
-
--- a/MoinMoin/script/account/disable.py	Sun Feb 20 21:44:35 2011 +0100
+++ b/MoinMoin/script/account/disable.py	Mon Feb 21 02:24:16 2011 +0100
@@ -2,15 +2,15 @@
 """
 MoinMoin - disable a user account
 
-TODO: Currently works on unprotected user backend
-
 @copyright: 2006 MoinMoin:ThomasWaldmann,
             2011 MoinMoin:ReimarBauer
 @license: GNU GPL, see COPYING for details.
 """
+
 from flask import flaskg
 from flask import current_app as app
 from flaskext.script import Command, Option
+
 from MoinMoin import user
 
 
@@ -18,11 +18,10 @@
     description = 'This command allows you to disable user accounts.'
     option_list = (
         Option('--name', '-n', required=False, dest='name', type=unicode,
-               help='Disable the user with user name NAME.'
-               ),
+               help='Disable the user with user name NAME.'),
         Option('--uid', '-u', required=False, dest='uid', type=unicode,
-               help='Disable the user with user id UID.' )
-        )
+               help='Disable the user with user id UID.'),
+    )
 
     def run(self, name, uid):
         flaskg.unprotected_storage = app.unprotected_storage
--- a/MoinMoin/script/account/resetpw.py	Sun Feb 20 21:44:35 2011 +0100
+++ b/MoinMoin/script/account/resetpw.py	Mon Feb 21 02:24:16 2011 +0100
@@ -1,29 +1,30 @@
 # -*- coding: iso-8859-1 -*-
 """
-MoinMoin - change a user password
-
-TODO: Currently works on unprotected user backend
+MoinMoin - set a user password
 
 @copyright: 2006 MoinMoin:ThomasWaldmann,
             2008 MoinMoin:JohannesBerg,
             2011 MoinMoin:ReimarBauer
 @license: GNU GPL, see COPYING for details.
 """
+
 from flask import flaskg
 from flask import current_app as app
 from flaskext.script import Command, Option
+
 from MoinMoin import user
 
-class Reset_Users_Password(Command):
-    description = 'This command allows you to change a user password.'
+
+class Set_Password(Command):
+    description = 'This command allows you to set a user password.'
     option_list = (
         Option('--name', '-n', required=False, dest='name', type=unicode,
-               help='Reset password for the user with user name NAME.'),
+               help='Set password for the user with user name NAME.'),
         Option('--uid', '-u', required=False, dest='uid', type=unicode,
-               help='Reset password for the user with user id UID.' ),
+               help='Set password for the user with user id UID.'),
         Option('--password', '-p', required=True, dest='password', type=unicode,
-               help='New password for this account.')
-        )
+               help='New password for this account.'),
+    )
 
     def run(self, name, uid, password):
         flaskg.unprotected_storage = app.unprotected_storage
@@ -45,4 +46,5 @@
 
         u.enc_password = user.encodePassword(password)
         u.save()
-        print 'Password changed.'
+        print 'Password set.'
+
--- a/moin	Sun Feb 20 21:44:35 2011 +0100
+++ b/moin	Mon Feb 21 02:24:16 2011 +0100
@@ -68,8 +68,8 @@
 manager.add_command("account_create", Create_User())
 from MoinMoin.script.account.disable import Disable_User
 manager.add_command("account_disable", Disable_User())
-from MoinMoin.script.account.resetpw import Reset_Users_Password
-manager.add_command("account_resetpw", Reset_Users_Password())
+from MoinMoin.script.account.resetpw import Set_Password
+manager.add_command("account_password", Set_Password())
 
 if __name__ == "__main__":
     if sys.argv == ['./moin']: