annotate data/plugin/script/account/subscribe.py @ 562:0a13d4186fa0

script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 07 Apr 2011 19:16:24 +0200
parents
children 127da830be6c
rev   line source
562
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
2 """
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
3 MoinMoin - subscribes or unsubscribes users to a page
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
4
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
5 @copyright: 2011 MoinMoin:ReimarBauer
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
7 """
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
8
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
9 from MoinMoin import user
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
10 from MoinMoin.Page import Page
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
11 from MoinMoin.script import MoinScript
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
12
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
13 class PluginScript(MoinScript):
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
14 """\
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
15 Purpose:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
16 ========
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
17 This tool allows you to subscribe or unsubscribe users of a wiki to a page
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
18
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
19 Detailed Instructions:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
20 ======================
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
21 General syntax: moin [options] account subscribe [subscribe-options]
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
22
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
23 [options] usually should be:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
24 --config-dir=/path/to/my/cfg/ --wiki-url=http://wiki.example.org/
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
25
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
26 1. Required is one of the options --name, ---group, --all-users.
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
27 To subscribe a user to a page use the --name argument. For subscribe by a group of users
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
28 give the --group page argument. Or with --all-users you subscribe ALL users.
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
29 2. Required is also the pagename of the page to subscribe too
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
30 3. Optional the selected users could be unsubscribed by --unsubscribe
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
31 """
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
32
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
33 def __init__(self, argv, def_values):
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
34 MoinScript.__init__(self, argv, def_values)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
35
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
36 self.parser.add_option(
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
37 "-u", "--user", dest="priviledged_user",
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
38 help="User as whom the homepage creation operation will be performed as."
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
39 )
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
40
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
41 self.parser.add_option(
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
42 "-n", "--name", dest="user_subscribe",
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
43 help="The name of the user to subscribe to a page."
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
44 )
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
45
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
46 self.parser.add_option(
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
47 "-g", "--group", dest="name_of_group_page",
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
48 help="The name of the group page to select users to subscribe to a page"
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
49 )
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
50
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
51 self.parser.add_option(
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
52 "-a", "--all-users", dest="all_users", action="store_true",
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
53 help="All existing users of the wiki to subscribe to a page"
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
54 )
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
55
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
56 self.parser.add_option(
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
57 "-r", "--unsubscribe", dest="unsubscribe", action="store_true",
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
58 help="unsubscribe users of a wiki page"
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
59 )
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
60
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
61 self.parser.add_option(
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
62 "-p", "--pagename", dest="pagename",
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
63 help="The name of the page to subscribe"
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
64 )
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
65
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
66
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
67 def write_subscription(self, account, pagename, unsubscribe=False):
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
68 # subscribes to a page
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
69 if account.exists() and not account.disabled and Page(self.request, pagename).exists():
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
70 if unsubscribe:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
71 account.unsubscribe(pagename)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
72 else:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
73 account.subscribe(pagename)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
74 account.save()
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
75
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
76 def mainloop(self):
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
77 # we don't expect non-option arguments
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
78 self.init_request()
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
79 request = self.request
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
80 # Check for user
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
81 if self.options.priviledged_user:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
82 uid = user.getUserId(request, self.options.priviledged_user)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
83 request.user = user.User(request, uid)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
84 # Check for Group definition
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
85 members = []
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
86 if self.options.user_subscribe:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
87 members = [self.options.user_subscribe, ]
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
88 elif self.options.name_of_group_page:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
89 members = request.groups.get(self.options.name_of_group_page, [])
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
90 elif self.options.all_users:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
91 uids = user.getUserList(request)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
92 members = [user.User(request, uid).name for uid in uids]
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
93
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
94 if not members:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
95 print "No user selected!"
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
96 return
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
97 if not self.options.pagename:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
98 print "No pagename given!"
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
99 return
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
100
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
101 # loop through members for doing the subscription
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
102 for name in members:
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
103 uid = user.getUserId(request, name)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
104 account = user.User(request, uid)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
105 self.write_subscription(account, self.options.pagename, unsubscribe=self.options.unsubscribe)
0a13d4186fa0 script.account.subscribe: introduced a cli script for subscribing/unsubscribing a user, members of a group or all valid users of the wiki to a page
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
106