~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/script/account/create.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: iso-8859-1 -*-
2
2
"""
3
 
    MoinMoin - create a user account
 
3
MoinMoin - create a user account
4
4
 
5
 
    @copyright: 2006 by MoinMoin:ThomasWaldmann
6
 
    @license: GNU GPL, see COPYING for details.
 
5
@copyright: 2006 MoinMoin:ThomasWaldmann
 
6
@license: GNU GPL, see COPYING for details.
7
7
"""
8
8
 
9
 
from MoinMoin.script._util import MoinScript
 
9
from MoinMoin.script import MoinScript
10
10
 
11
11
class PluginScript(MoinScript):
 
12
    """\
 
13
Purpose:
 
14
========
 
15
This tool allows you to create user accounts via a command line interface.
 
16
 
 
17
Detailed Instructions:
 
18
======================
 
19
General syntax: moin [options] account create [create-options]
 
20
 
 
21
[options] usually should be:
 
22
    --config-dir=/path/to/my/cfg/ --wiki-url=wiki.example.org/
 
23
 
 
24
[create-options] see below:
 
25
    0. Verify that the account does not exist.
 
26
       Currently this script does not check if the user exists.
 
27
 
 
28
    1. Verify that you have specified the right options.
 
29
       This script does no verification of email addresses or the like.
 
30
 
 
31
    2. To create a normal user 'JohnSmith' with an alias of 'JSmith' and an
 
32
       email of 'john@smith.com'
 
33
       moin ... account create --name JohnSmith --alias JSmith --email john@smith.com
 
34
"""
 
35
 
12
36
    def __init__(self, argv, def_values):
13
37
        MoinScript.__init__(self, argv, def_values)
14
38
        self.parser.add_option(
42
66
        self.init_request()
43
67
        request = self.request
44
68
 
45
 
        from MoinMoin import user, wikiutil
 
69
        from MoinMoin import user
46
70
        u = user.User(request, None, self.options.uname, password=self.options.password)
47
71
        u.email = self.options.email
48
72
        u.aliasname = self.options.ualiasname or ''
49
73
        print " %-20s %-25s %-35s" % (u.id, u.name, u.email),
50
74
        u.save()
51
75
        print "- created."
52