view MoinMoin/script/account/ @ 1767:54be46b8a0b4

flask ext import change Flask extensions should urge users to import from instead of flask_foo or flaskext_foo.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 02 Sep 2012 21:53:25 +0200
parents 2be00a5febbe
children ff503e7ea7a0
line wrap: on
line source
# Copyright: 2006 MoinMoin:ThomasWaldmann
# Copyright: 2011 MoinMoin:ReimarBauer
# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.

MoinMoin - create a user account

from flask import current_app as app
from flask import g as flaskg
from flask.ext.script import Command, Option

from MoinMoin import user
from import before_wiki

class Create_User(Command):
    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."),
        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)."),
        Option('--email', '-e', required=True, dest='email', type=unicode,
               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."),
        Option('--password', '-p', required=True, dest="password", type=unicode,
               help="Set the user's password to PASSWORD."),

    def run(self, name, aliasname, email, openid, password):
        msg = user.create_user(username=name,

        if msg:
            print msg
            u = user.User(auth_username=name)
            print " %-20s %-25s %-35s - created." % (u.itemid,,,