Merge lp://staging/~cyphermox/pastebinit/dev-arbitrary-dest into lp://staging/pastebinit
- dev-arbitrary-dest
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp://staging/~cyphermox/pastebinit/dev-arbitrary-dest | ||||
Merge into: | lp://staging/pastebinit | ||||
Diff against target: |
576 lines 14 files modified
README (+123/-0) pastebin.d/fpaste.org.conf (+17/-0) pastebin.d/gist.github.com.conf (+13/-0) pastebin.d/paste.debian.net.conf (+16/-0) pastebin.d/paste.ubuntu.com.conf (+10/-0) pastebin.d/paste2.org.conf (+14/-0) pastebin.d/pastebin.ca.conf (+17/-0) pastebin.d/pastebin.com.conf (+19/-0) pastebin.d/pastey.net.conf (+18/-0) pastebin.d/rafb.net.conf (+15/-0) pastebin.d/slexy.org.conf (+24/-0) pastebin.d/stikked.com.conf (+18/-0) pastebin.d/yourpaste.net.conf (+21/-0) pastebinit (+46/-92) |
||||
To merge this branch: | bzr merge lp://staging/~cyphermox/pastebinit/dev-arbitrary-dest | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stéphane Graber | Pending | ||
Mathieu Trudel-Lapierre | Pending | ||
Review via email:
|
This proposal supersedes a proposal from 2009-08-13.
Commit message
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mathieu Trudel-Lapierre (cyphermox) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Stéphane Graber (stgraber) wrote : Posted in a previous version of this proposal | # |
Hi,
Thanks a lot for your patch.
Before merging it, may I suggest you improve the README file a bit ?
I found it quite confusing (though then reading the actual configuration of a pastebin, makes it a lot easier to understand) and contains a few typos (psatebin instead of pastebin for example).
Also, in the code, I'd suggest getting rid of the old code instead of commenting it as soon as it's converted to the new format. We have bzr if we need to retrieve older revisions.
Again, thanks for all the work, it's really appreciated.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mathieu Trudel-Lapierre (cyphermox) wrote : Posted in a previous version of this proposal | # |
Fixed the spelling and removed the commented stuff.
I've also reworked the README file and hopefully made it much clearer. If not, please let me know where things are messy or confusing, so that I can fix it :)
Thanks,
/ Matt
Preview Diff
1 | === added file 'README' |
2 | --- README 1970-01-01 00:00:00 +0000 |
3 | +++ README 2009-10-22 01:10:21 +0000 |
4 | @@ -0,0 +1,123 @@ |
5 | + |
6 | +USING PASTEBIN.D FILES |
7 | + |
8 | +To enable support for private pastebins, first you will need to know the fields |
9 | +that are in use by the pastebin when posting data. |
10 | + |
11 | +Add a file in the /etc/pastebin.d directory with the following format: |
12 | + |
13 | +[pastebin] |
14 | +basename = domain.name |
15 | +regexp = "http://(.*)\.?domain.name/" |
16 | + |
17 | +[format] |
18 | +reserved_keyword = pastebin_site_field |
19 | +custom_keyword = pastebin_site_field |
20 | + |
21 | +[defaults] |
22 | +custom_keyword = value |
23 | + |
24 | + |
25 | +THE PASTEBIN SECTION |
26 | + |
27 | +Under "[pastebin]", you will want to keep the very basic information to |
28 | +identify the pastebin. Only two fields are used in that section: |
29 | + |
30 | + basename - the generic domain name for the pastebin. |
31 | + this domain name should not contain |
32 | + possible sub-domains in use. |
33 | + |
34 | + regexp - a regular expression that matches the |
35 | + basename, as well as any sub-domains that |
36 | + may be in use. |
37 | + |
38 | + |
39 | +THE FORMAT SECTION |
40 | + |
41 | +Under "[format]", identify the various fields in use in the pastebin you want |
42 | +to setup. Identify any fields used to publish data on the pastebin, and add |
43 | +them to the configuration file. |
44 | + |
45 | +The "[format]" section expects reserved and custom keywords matched to the real |
46 | +name for the field for the pastebin you are setting up. In other words, the |
47 | +data that a reserved or custom keyword (the left-hand side) refers to will be |
48 | +put in the named field assigned to it (the right-hand side). |
49 | + |
50 | +A number of reserved keywords can be used, but are optional: |
51 | + |
52 | + user - contains the username for the user |
53 | + calling the pastebinit utility. |
54 | + |
55 | + content - contains the data that will be posted. |
56 | + |
57 | + title - contains the title if set at the command |
58 | + line. |
59 | + |
60 | + version - contains the version as set at the |
61 | + command line. |
62 | + |
63 | + format - contains the format setting: |
64 | + usually used for syntax highlighting. |
65 | + |
66 | + parentpid - contains the parent post ID for |
67 | + pastebins that use it. |
68 | + |
69 | + permatag - contains permatag as set at the command |
70 | + line. |
71 | + |
72 | + username - contains the pastebin username if |
73 | + required. |
74 | + |
75 | + password - contains the pastebin user's password |
76 | + if required. |
77 | + |
78 | + jabberid - contains the jabberid for the poster |
79 | + as set at the command line. |
80 | + |
81 | +Two additional special parameters are available for use: |
82 | + |
83 | + page - used to specify a page from which to |
84 | + post data. It is the actual URL of |
85 | + the pastebin's form. |
86 | + |
87 | + regexp - used to specify a regexp to execute |
88 | + on the resulting page after posting. |
89 | + This is useful to deal with special |
90 | + pastebins that don't redirect you |
91 | + to the new post's URL. |
92 | + |
93 | +Add any other fields in use for the specific pastebin you are setting up may be |
94 | +added to the "[format]" section using the same syntax. |
95 | + |
96 | +An easy way to deal with special parameters that need to be passed to the |
97 | +pastebin, such as expiry time for a post, is to assign the pastebin's field |
98 | +name to a variable, and set the correct value for that variable under the |
99 | +"[defaults]" section later, as such: |
100 | + |
101 | +[format] |
102 | +expire = expiry |
103 | + |
104 | +[defaults] |
105 | +expire = 365 |
106 | + |
107 | +Where 'expire' can then be reused as the keyword to retrieve a static value in |
108 | +the '[defaults]' section. See below for an example. |
109 | + |
110 | + |
111 | +THE DEFAULTS SECTION |
112 | + |
113 | +The '[defaults]' section is used to set static values for custom fields. |
114 | + |
115 | +Some pastebins require setting fields such as expiry time for posts, or |
116 | +whether to use cookies. Such values are set using a custom field, followed by |
117 | +the value to give it. |
118 | + |
119 | +To reuse the example above, statically set a post to be expire after 365 days: |
120 | + |
121 | +[defaults] |
122 | +expire = 365 |
123 | + |
124 | +Here, the value 365 will be assigned to the expire keyword. In the "[format]" |
125 | +section, the value in the expire keyword is applied to the field called |
126 | +"expiry". |
127 | + |
128 | |
129 | === added directory 'pastebin.d' |
130 | === added file 'pastebin.d/fpaste.org.conf' |
131 | --- pastebin.d/fpaste.org.conf 1970-01-01 00:00:00 +0000 |
132 | +++ pastebin.d/fpaste.org.conf 2009-10-22 01:10:21 +0000 |
133 | @@ -0,0 +1,17 @@ |
134 | +# Another website that doesn't work due to unusual changes. |
135 | +# this is the Fedora Pastebin, sadly. |
136 | + |
137 | +[pastebin] |
138 | +basename = fpaste.org |
139 | +regexp = "http://fpaste.org" |
140 | + |
141 | +[format] |
142 | +user = author |
143 | +content = content |
144 | +format = lang |
145 | +submit = submit |
146 | +expire_options = expire_options |
147 | + |
148 | +[defaults] |
149 | +submit = "paste it!" |
150 | +expire_options = 3600 |
151 | |
152 | === added file 'pastebin.d/gist.github.com.conf' |
153 | --- pastebin.d/gist.github.com.conf 1970-01-01 00:00:00 +0000 |
154 | +++ pastebin.d/gist.github.com.conf 2009-10-22 01:10:21 +0000 |
155 | @@ -0,0 +1,13 @@ |
156 | +[pastebin] |
157 | +basename = gist.github.com |
158 | +regexp = "http://gist.github.com" |
159 | + |
160 | +[format] |
161 | +page = page |
162 | +user = poster |
163 | +format = file_ext[gistfile1] |
164 | +content = file_contents[gistfile1] |
165 | +title = file_name[gistfile1] |
166 | + |
167 | +[defaults] |
168 | +page = '/gists' |
169 | |
170 | === added file 'pastebin.d/paste.debian.net.conf' |
171 | --- pastebin.d/paste.debian.net.conf 1970-01-01 00:00:00 +0000 |
172 | +++ pastebin.d/paste.debian.net.conf 2009-10-22 01:10:21 +0000 |
173 | @@ -0,0 +1,16 @@ |
174 | +[pastebin] |
175 | +basename = paste.debian.net |
176 | +regexp = "http://paste.debian.net" |
177 | + |
178 | +[format] |
179 | +user = poster |
180 | +content = code |
181 | +format = syntax |
182 | +lang = lang |
183 | +remember = remember |
184 | +expire = expire |
185 | + |
186 | +[defaults] |
187 | +lang = -1 |
188 | +remember = 0 |
189 | +expire = 259200 |
190 | |
191 | === added file 'pastebin.d/paste.ubuntu.com.conf' |
192 | --- pastebin.d/paste.ubuntu.com.conf 1970-01-01 00:00:00 +0000 |
193 | +++ pastebin.d/paste.ubuntu.com.conf 2009-10-22 01:10:21 +0000 |
194 | @@ -0,0 +1,10 @@ |
195 | +[pastebin] |
196 | +basename = paste.ubuntu.com |
197 | +regexp = "http://paste.ubuntu.com" |
198 | + |
199 | +[format] |
200 | +user = poster |
201 | +content = content |
202 | +format = syntax |
203 | + |
204 | +[defaults] |
205 | |
206 | === added file 'pastebin.d/paste2.org.conf' |
207 | --- pastebin.d/paste2.org.conf 1970-01-01 00:00:00 +0000 |
208 | +++ pastebin.d/paste2.org.conf 2009-10-22 01:10:21 +0000 |
209 | @@ -0,0 +1,14 @@ |
210 | +[pastebin] |
211 | +basename = paste2.org |
212 | +regexp = "http://paste2.org" |
213 | + |
214 | +[format] |
215 | +title = description |
216 | +content = code |
217 | +format = lang |
218 | +page = page |
219 | +parent = parent |
220 | + |
221 | +[defaults] |
222 | +page = '/new-paste' |
223 | +parent = 0 |
224 | |
225 | === added file 'pastebin.d/pastebin.ca.conf' |
226 | --- pastebin.d/pastebin.ca.conf 1970-01-01 00:00:00 +0000 |
227 | +++ pastebin.d/pastebin.ca.conf 2009-10-22 01:10:21 +0000 |
228 | @@ -0,0 +1,17 @@ |
229 | +[pastebin] |
230 | +basename = pastebin.ca |
231 | +regexp = "http://((([a-zA-Z0-9\-_\.]*)(pastebin\.ca)))" |
232 | + |
233 | +[format] |
234 | +user = name |
235 | +content = content |
236 | +type = type |
237 | +save = save |
238 | +submit = submit |
239 | +regexp = regexp |
240 | + |
241 | +[defaults] |
242 | +type = 1 |
243 | +save = 0 |
244 | +submit = s |
245 | +regexp = '">http://.*pastebin.ca/(.*)</a></p><p>' |
246 | |
247 | === added file 'pastebin.d/pastebin.com.conf' |
248 | --- pastebin.d/pastebin.com.conf 1970-01-01 00:00:00 +0000 |
249 | +++ pastebin.d/pastebin.com.conf 2009-10-22 01:10:21 +0000 |
250 | @@ -0,0 +1,19 @@ |
251 | +[pastebin] |
252 | +basename = pastebin.com |
253 | +regexp = "http://((([a-zA-Z0-9\-_\.]*)(pastebin\.com)))" |
254 | +#FIXME: not website == "http://www.pastebin.com") or website == "http://pastebin.mozilla.org": |
255 | + |
256 | +[format] |
257 | +user = poster |
258 | +content = code2 |
259 | +version = version |
260 | +parentpid = parent_pid |
261 | +format = format |
262 | +submit = paste |
263 | +remember = remember |
264 | +expiry = expiry |
265 | + |
266 | +[defaults] |
267 | +remember = f |
268 | +expiry = 1 |
269 | +paste = Send |
270 | |
271 | === added file 'pastebin.d/pastey.net.conf' |
272 | --- pastebin.d/pastey.net.conf 1970-01-01 00:00:00 +0000 |
273 | +++ pastebin.d/pastey.net.conf 2009-10-22 01:10:21 +0000 |
274 | @@ -0,0 +1,18 @@ |
275 | +[pastebin] |
276 | +basename = pastey.net |
277 | +regexp = "http://((([a-zA-Z0-9\-_\.]*)(pastey\.net)))" |
278 | + |
279 | +[format] |
280 | +user = author |
281 | +title = subject |
282 | +parentpid = parent |
283 | +content = text |
284 | +format = language |
285 | +paste = paste |
286 | +page = page |
287 | +regexp = regexp |
288 | + |
289 | +[defaults] |
290 | +paste = "Paste" |
291 | +page = '/submit.php' |
292 | +regexp = '">http://(?:(?:[a-zA-Z0-9\-_\.]*)(?:pastey\.net))/(.*)</a>' |
293 | |
294 | === added file 'pastebin.d/rafb.net.conf' |
295 | --- pastebin.d/rafb.net.conf 1970-01-01 00:00:00 +0000 |
296 | +++ pastebin.d/rafb.net.conf 2009-10-22 01:10:21 +0000 |
297 | @@ -0,0 +1,15 @@ |
298 | +[pastebin] |
299 | +basename = rafb.net |
300 | +regexp = "http://rafb.net" |
301 | + |
302 | +[format] |
303 | +user = nick |
304 | +content = text |
305 | +page = page |
306 | +lang = lang |
307 | +cvt_tabs = cvt_tabs |
308 | + |
309 | +[defaults] |
310 | +page = "/paste/paste.php" |
311 | +lang = "Plain Text" |
312 | +cvt_tabs = "No" |
313 | |
314 | === added file 'pastebin.d/slexy.org.conf' |
315 | --- pastebin.d/slexy.org.conf 1970-01-01 00:00:00 +0000 |
316 | +++ pastebin.d/slexy.org.conf 2009-10-22 01:10:21 +0000 |
317 | @@ -0,0 +1,24 @@ |
318 | +[pastebin] |
319 | +basename = slexy.org |
320 | +regexp = "http://slexy.org" |
321 | + |
322 | +[format] |
323 | +user = author |
324 | +content = raw_paste |
325 | +title = desc |
326 | +page = page |
327 | +language = language |
328 | +permissions = permissions |
329 | +linenumbers = linenumbers |
330 | +comment = comment |
331 | +submit = submit |
332 | +expire = expire |
333 | + |
334 | +[defaults] |
335 | +submit = "Submit Paste" |
336 | +page = "/index.php/submit" |
337 | +language = "text" |
338 | +permissions = 0 |
339 | +comment = "" |
340 | +linenumbers = 0 |
341 | +expire = 0 |
342 | |
343 | === added file 'pastebin.d/stikked.com.conf' |
344 | --- pastebin.d/stikked.com.conf 1970-01-01 00:00:00 +0000 |
345 | +++ pastebin.d/stikked.com.conf 2009-10-22 01:10:21 +0000 |
346 | @@ -0,0 +1,18 @@ |
347 | +[pastebin] |
348 | +basename = stikked.com |
349 | +regexp = "http://stikked.com" |
350 | + |
351 | +[format] |
352 | +user = name |
353 | +content = code |
354 | +title = title |
355 | +email = email |
356 | +lang = lang |
357 | +website = website |
358 | +submit = submit |
359 | + |
360 | +[defaults] |
361 | +email = "" |
362 | +lang = "text" |
363 | +website = "" |
364 | +submit = "submit" |
365 | |
366 | === added file 'pastebin.d/yourpaste.net.conf' |
367 | --- pastebin.d/yourpaste.net.conf 1970-01-01 00:00:00 +0000 |
368 | +++ pastebin.d/yourpaste.net.conf 2009-10-22 01:10:21 +0000 |
369 | @@ -0,0 +1,21 @@ |
370 | +[pastebin] |
371 | +basename = yourpaste.net |
372 | +regexp = "http://yourpaste.net" |
373 | + |
374 | +[format] |
375 | +format = syntax |
376 | +user = name |
377 | +title = desc |
378 | +expire = expire |
379 | +content = code |
380 | +private = private |
381 | +remember = remember |
382 | +page = page |
383 | +regexp = regexp |
384 | + |
385 | +[defaults] |
386 | +expire = 0 |
387 | +private = 0 |
388 | +remember = 0 |
389 | +page = '/paste' |
390 | +regexp = '">http://yourpaste.net(.*)</a>' |
391 | |
392 | === modified file 'pastebinit' |
393 | --- pastebinit 2009-03-10 05:23:09 +0000 |
394 | +++ pastebinit 2009-10-22 01:10:21 +0000 |
395 | @@ -20,6 +20,7 @@ |
396 | try: |
397 | import urllib, os, sys, re, getopt, select, xml.dom.minidom, gettext |
398 | from gettext import gettext as _ |
399 | + from configobj import ConfigObj |
400 | |
401 | gettext.textdomain("pastebinit") |
402 | |
403 | @@ -32,16 +33,26 @@ |
404 | def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): |
405 | return None |
406 | |
407 | + def preloadPastebins(): |
408 | + confdir = '/etc/pastebin.d/' |
409 | + confdirlist = os.listdir(confdir) |
410 | + pastebind = {} |
411 | + for fileitem in confdirlist: |
412 | + bininstance = ConfigObj(confdir + fileitem) |
413 | + basename = bininstance['pastebin']['basename'] |
414 | + pastebind[basename] = bininstance |
415 | + return pastebind |
416 | + |
417 | # pastey.net obfuscates parent ids for replies. Rather than taking the |
418 | # post ID given as the parent ID, we must handle this by going to that |
419 | # post page and looking up what the invisible parent ID field will be |
420 | # set to for children. |
421 | - def pasteyParentFixup(website, parentid): |
422 | + def doParentFixup(website, paramname, parentid): |
423 | if parentid == "": |
424 | return "" |
425 | url_opener = pasteURLopener() |
426 | page = url_opener.open(website + '/' + parentid, None) |
427 | - matches = re.split('<input.*?name="parent".*?value="(.*?)"', page.read()) |
428 | + matches = re.split('<input.*?name="' + paramname + '".*?value="(.*?)"', page.read()) |
429 | if len(matches) <= 1 or re.match(parentid, matches[1]) == None: |
430 | # The obfuscated version didn't begin with the partial version, |
431 | # or unable to find the obfuscated version for some reason! |
432 | @@ -50,7 +61,7 @@ |
433 | return matches[1] |
434 | |
435 | #Return the parameters depending of the pastebin used |
436 | - def getParameters(website, content, user, jabberid, version, format, parentpid, permatag, title, username, password): |
437 | + def getParameters(website, pastebind, content, user, jabberid, version, format, parentpid, permatag, title, username, password): |
438 | "Return the parameters array for the selected pastebin" |
439 | params={} |
440 | # pastebin.com v0.50 |
441 | @@ -70,95 +81,37 @@ |
442 | params['save'] = "0" #Do you want a cookie ? |
443 | params['s'] = "Submit Post" |
444 | params['regexp'] = '">http://.*pastebin.ca/(.*)</a></p><p>' |
445 | -# elif re.search("http://((([a-zA-Z0-9\-_\.]*)(1t2\.us)))", website): |
446 | -# params['poster'] = user |
447 | -# params['jid'] = jabberid |
448 | -# params['code2'] = content |
449 | -# params['parent_pid'] = parentpid #For reply, "" means homepage (new thread) |
450 | -# params['format'] = format #The format, for syntax hilighting |
451 | -# params['paste'] = "Send" |
452 | -# params['remember'] = "0" #Do you want a cookie ? |
453 | -# params['expiry'] = "f" #The expiration, f = forever |
454 | -# params['permatag'] = permatag |
455 | -# params['title'] = title |
456 | -# params['username'] = username |
457 | -# params['password'] = password |
458 | -# params['version'] = version |
459 | - elif website == "http://rafb.net": |
460 | - params['page'] = "/paste/paste.php" |
461 | - params['nick'] = user |
462 | - params['text'] = content |
463 | - params['lang'] = "Plain Text" #The format, for syntax hilighting |
464 | - params['cvt_tabs'] = "No" |
465 | - elif website == "http://stikked.com": |
466 | - params['name'] = user |
467 | - params['title'] = title |
468 | - params['email'] = "" |
469 | - params['lang'] = "text" #The format, for syntax hilighting |
470 | - params['code'] = content |
471 | - params['website'] = "" |
472 | - params['submit'] = "submit" |
473 | - elif website == "http://slexy.org": |
474 | - params['page'] = "/index.php/submit" |
475 | - params['raw_paste'] = content |
476 | - params['comment'] = "" |
477 | - params['author'] = user |
478 | - params['language'] = "text" #The format, for syntax hilighting |
479 | - params['permissions'] = "0" |
480 | - params['desc'] = title |
481 | - params['linenumbers'] = "0" |
482 | - params['expire'] = "0" |
483 | - params['submit'] = "Submit Paste" |
484 | - elif website == "http://fpaste.org": |
485 | - params['lang'] = format #The format, for syntax hilighting |
486 | - params['page'] = "/paste/save" |
487 | - params['content'] = content |
488 | - params['submit'] = "pastebinit" |
489 | - elif website == "http://paste2.org": |
490 | - params['page'] = "/new-paste" |
491 | - params['description'] = title |
492 | - params['lang'] = format |
493 | - params['code'] = content |
494 | - params['parent'] = "0" |
495 | - elif re.search("http://((([a-zA-Z0-9\-_\.]*)(pastey\.net)))", website): |
496 | - params['author'] = user |
497 | - params['subject'] = title |
498 | - params['parent'] = pasteyParentFixup(website, parentpid) |
499 | - params['text'] = content |
500 | - params['language'] = format # File format, as a string like "cpp" or "lua" |
501 | - params['paste'] = "Paste" |
502 | - params['page'] = '/submit.php' |
503 | - params['regexp'] = '">http://(?:(?:[a-zA-Z0-9\-_\.]*)(?:pastey\.net))(/.*)</a>' |
504 | - elif website == "http://yourpaste.net": |
505 | - params['syntax'] = format |
506 | - params['name'] = user |
507 | - params['desc'] = title |
508 | - params['expire'] = "0" # Forever |
509 | - params['code'] = content |
510 | - params['private'] = "0" # It's not a private post |
511 | - params['remember'] = "0" # Cookies? ;) |
512 | - params['page'] = "/paste" |
513 | - params['regexp'] = '">http://yourpaste.net(.*)/</a>' |
514 | - elif website == "http://gist.github.com": |
515 | - params['page'] = "/gists" |
516 | - params['poster'] = user |
517 | - params['file_ext[gistfile1]'] = format #The format, for syntax hilighting |
518 | - params['file_contents[gistfile1]'] = content |
519 | - params['file_name[gistfile1]'] = title |
520 | - elif website == "http://paste.ubuntu.com": |
521 | - params['poster'] = user |
522 | - params['syntax'] = format #The format, for syntax hilighting |
523 | - params['content'] = content |
524 | - elif website == "http://paste.debian.net": |
525 | - params['poster'] = user |
526 | - params['lang'] = "-1" #The format, for syntax hilighting, default to plain text |
527 | - params['syntax'] = format #The format, for syntax hilighting |
528 | - params['code'] = content |
529 | - params['remember'] = "0" #Do you want a cookie ? |
530 | - params['expire'] = "259200" # expire in 72h |
531 | else: |
532 | - sys.exit(_("Unknown website, please post a bugreport to request this pastebin to be added (%s)") % website) |
533 | - return params |
534 | + for pastebin in pastebind: |
535 | + if re.search( pastebind[pastebin]['pastebin']['regexp'], website ): |
536 | + for param in pastebind[pastebin]['format'].keys(): |
537 | + paramname = pastebind[pastebin]['format'][param] |
538 | + if param == 'user': |
539 | + params[paramname] = user |
540 | + elif param == 'content': |
541 | + params[paramname] = content |
542 | + elif param == 'title': |
543 | + params[paramname] = title |
544 | + elif param == 'version': |
545 | + params[paramname] = version |
546 | + elif param == 'format': |
547 | + params[paramname] = format |
548 | + elif param == 'parentpid': |
549 | + params[paramname] = doParentFixup(website, paramname, parentpid) |
550 | + elif param == 'permatag': |
551 | + params[paramname] = parmatag |
552 | + elif param == 'username': |
553 | + params[paramname] = username |
554 | + elif param == 'password': |
555 | + params[paramname] = password |
556 | + elif param == 'jabberid': |
557 | + params[paramname] = jabberid |
558 | + else: |
559 | + params[paramname] = pastebind[pastebin]['defaults'][paramname] |
560 | + if params: |
561 | + return params |
562 | + else: |
563 | + sys.exit(_("Unknown website, please post a bugreport to request this pastebin to be added (%s)") % website) |
564 | |
565 | #XML Handling methods |
566 | def getText(nodelist): |
567 | @@ -297,7 +250,8 @@ |
568 | sys.exit(_("Unable to read from: %s") % filename) |
569 | if not content: |
570 | sys.exit(_("You are trying to send an empty document, exiting.")) |
571 | - params = getParameters(website, content, user, jabberid, version, format, parentpid, permatag, title, username, password) #Get the parameters array |
572 | + pastebind = preloadPastebins() #get the config from /etc/pastebin.d/ |
573 | + params = getParameters(website, pastebind, content, user, jabberid, version, format, parentpid, permatag, title, username, password) #Get the parameters array |
574 | |
575 | if not re.search(".*/", website): |
576 | website += "/" |
Fixes bug #369795 by proposing a format for configuration files that define new personal/public pastebins.
Most pastebins already supported in the script have been factored out to config files in this branch, and commented out in the main script. The only ones kept in the main script (but also available as config files), are pastebin.com and pastebin.ca.