forked from jtmorgan/grantsbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput_settings.py
247 lines (238 loc) · 12 KB
/
output_settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#! /usr/bin/python2.7
# Copyright 2013 Jtmorgan
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class Params:
"""
output parameters for building various kinds of profiles and their values and settings.
"""
def __init__(self):
self.output_params = {
'pattern_guide' : {
'infobox params' : {
'summary' : '^\|\s*problem\s*=',
'image' : '^\|\s*image\s*=',
},
'header template' : """<noinclude>[[Category:Learning_Pattern_Library]] {{mbox|text='''This page is updated daily by [[User:GrantsBot|GrantsBot]].''' Edits made by others may be inadvertently overwritten the next time the bot runs. If you have a question, or see an error that needs to be fixed, please post to the [[Grants_talk:Learning_patterns|Library talk page]]. You may also contact [[User:Jmorgan (WMF)|GrantsBot's maintainer]] directly.}}</noinclude>""",
'main namespace' : 200,
'output path' : 'Grants:Learning_patterns/',
'ignored pages' : ['Grants:IdeaLab/Preload',], #more ignored pages for inspire?
'formatted fields' : ['problem'],
'edit summary' : 'Updating %s',
'all' : {
'categories' : ['Learning_patterns',],
'subpage' : 'All',
'time value' : 'timestamp',
},
},
'idealab_guide' : {
'infobox params' : {
'summary' : '^\|\s*summary\s*=',
'image' : '^\|\s*image\s*=',
},
'header template' : """<noinclude>[[Category:IdeaLab]]</noinclude>""",
'main namespace' : 200,
'output path' : 'Grants:IdeaLab/',
'ignored pages' : ['Grants:IdeaLab/Preload',],
'formatted fields' : ['summary',],
'edit summary' : 'Updating %s',
'participants' : {
'categories' : ['IdeaLab/Ideas/Participants',],
'subpage' : 'Participants',
'time value' : 'timestamp',
},
'draft' : {
'categories' : ['IEG/Proposals/Draft', 'IdeaLab/Ideas/Proposal',],
'subpage' : 'Ideas/Drafts',
'time value' : 'timestamp',
},
'new' : {
'categories' : ['IdeaLab/Ideas/IdeaLab','IdeaLab/Ideas/Inspire',],
'subpage' : 'Ideas/New',
'time value' : 'created',
},
'all' : {
'categories' : ['IdeaLab/Ideas/IdeaLab','IdeaLab/Ideas/Inspire',],
'subpage' : 'Ideas/All',
'time value' : 'timestamp',
},
'inspire-all' : {
'categories' : ['IdeaLab/Ideas/Inspire',],
'subpage' : 'Inspire/All',
'time value' : 'timestamp',
},
'inspire-draft' : {
'categories' : ['IdeaLab/Ideas/Proposal',],
'subpage' : 'Inspire/Drafts',
'time value' : 'timestamp',
},
},
'idealab_profile_guide' : {
'infobox params' : {
'story' : '^\|\s*story\s*=',
'image' : '^\|\s*image\s*=',
'skills' : '^\|\s*skills\s*=',
},
'header template' : """<noinclude>
[[Category:IdeaLab]]
{| class="infobox" style="width: 120px;"
| colspan="2" | '''Can't find your profile?''' [[Grants:IdeaLab/Introductions/Archive|Check to archive]].
|}
</noinclude>""",
'main namespace' : 200,
'output path' : 'Grants:IdeaLab/',
'ignored pages' : ['Grants:IdeaLab/Preload',],
'formatted fields' : ['story', 'skills'],
'edit summary' : 'Updating %s',
'inspire-profiles' : {
'categories' : ['IdeaLab_members',],
'subpage' : 'Introductions',
'time value' : 'created',
},
},
'idealab_feed' : { #fixme
'output path' : 'Grants:IdeaLab/Ideas/Activity',
'ignored pages' : ['Grants:IdeaLab/Preload',],
'number featured' : 6,
'main page' : 'Grants:IdeaLab/Ideas/Activity',
'main namespace' : 200,
'username' : '',
'output section' : '',
'edit summary' : 'Updating %s entries',
'header template' : """<noinclude>[[Category:IdeaLab]]</noinclude>""",
'activity' : {
'new idea' : {
'action' : 1,
'category' : 'IdeaLab/Ideas/Active',
},
'ieg' : {
'action' : 4,
'category' : 'IEG/Proposals/Draft',
},
'participants wanted' : {
'action' : 3,
'category' : 'IdeaLab/Ideas/Participants',
},
'joined' : {
'action' : 5,
},
},
},
'inspire_feed' : { #needs update
'output path' : 'Grants:IdeaLab/Inspire/Activity',
'ignored pages' : ['Grants:IdeaLab/Preload',], #others?
'number featured' : 6,
'main page' : 'Grants:IdeaLab/Inspire/Activity',
'main namespace' : 200,
'username' : '',
'output section' : '',
'edit summary' : 'Updating %s entries',
'header template' : """<noinclude>[[Category:IdeaLab]]</noinclude>""",
'activity' : {
'new idea' : {
'action' : 1,
'category' : 'IdeaLab/Ideas/Inspire',
},
'ieg' : {
'action' : 4,
'category' : 'IEG/Proposals/Draft',
},
'participants wanted' : {
'action' : 3,
'category' : 'IdeaLab/Ideas/Participants',
},
'joined' : {
'action' : 5,
},
},
},
'idealab_gallery' : {
'edit summary' : 'Updating %s profiles',
'header template' : '<noinclude>[[Category:IdeaLab]]</noinclude>',
'new_idea' : {
'output path' : 'Grants:IdeaLab/Ideas/Featured/',
'action' : 1,
'input page path' : 'Grants:IdeaLab/Ideas/New',
'input page id' : 2289291,
'profile toclevel' : 1,
'first subpage' : 1,
'number featured' : 2,
'infobox params' : {
'summary' : '^\|\s*summary\s*=',
'image' : '^\|\s*image\s*=',
'page path' : '^\|\s*idea link\s*=',
'time' : '^\|\s*time\s*=',
},
},
'participants_wanted' : {
'output path' : 'Grants:IdeaLab/Ideas/Featured/',
'action' : 3,
'input page path' : 'Grants:IdeaLab/Ideas/Participants',
'input page id' : 2294498,
'first subpage' : 3,
'number featured' : 2,
'profile toclevel' : 1,
'infobox params' : {
'summary' : '^\|\s*summary\s*=',
'image' : '^\|\s*image\s*=',
'page path' : '^\|\s*idea link\s*=',
'time' : '^\|\s*time\s*=',
},
},
'ieg_draft' : {
'output path' : 'Grants:IdeaLab/Ideas/Featured/',
'action' : 4,
'input page path' : 'Grants:IdeaLab/Ideas/Drafts',
'input page id' : 2294500,
'first subpage' : 5,
'number featured' : 2,
'profile toclevel' : 1,
'infobox params' : {
'summary' : '^\|\s*summary\s*=',
'image' : '^\|\s*image\s*=',
'page path' : '^\|\s*idea link\s*=',
'time' : '^\|\s*time\s*=',
},
},
'intro' : {
'output path' : 'Grants:IdeaLab/Introductions/Featured/',
'action' : 5,
'input page path' : 'Grants:IdeaLab/Introductions',
'input page id' : 2101758,
'first subpage' : 1,
'number featured' : 6,
'profile toclevel' : 1,
'infobox params' : {
'summary' : '^\|\s*story\s*=',
'page path' : '^\|\s*link\s*=',
'image' : '^\|\s*image\s*=',
'time' : '^\|\s*timestamp\s*=',
},
},
},
'idealab_intro' : {
'output path' : 'Grants:IdeaLab/Introductions',
'output page id' : 2101758,
'main namespace' : 200,
'talk namespace' : 201,
'edit summary' : 'Reordering %ss, putting recently active participants at the top',
},
'profile defaults' : ['action','badge','datetime','image','page id','page path','participants', 'problem', 'summary', 'create date', 'talkpage id','time','timestamp','title','title link','username','item', 'name', ]
,
'learning reports' : {
'output path' : 'Grants:Evaluation/Boiler room/Grants lessons 2012',
'header template' : '<noinclude>[[Category:Evaluation portal]]</noinclude>\n',
'edit summary' : 'adding lessons learned sections of grant reports',
},
}
def getParams(self, profile_type):
tp = self.output_params[profile_type]
return tp