Merge lp:~blueyed/pastebinit/format-from-conf-defaults into lp:pastebinit

Proposed by Daniel Hahler
Status: Merged
Merged at revision: 219
Proposed branch: lp:~blueyed/pastebinit/format-from-conf-defaults
Merge into: lp:pastebinit
Diff against target: 38 lines (+7/-4)
1 file modified
pastebinit (+7/-4)
To merge this branch: bzr merge lp:~blueyed/pastebinit/format-from-conf-defaults
Reviewer Review Type Date Requested Status
Pastebinit Developers Pending
Review via email: mp+203650@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pastebinit'
2--- pastebinit 2014-01-18 04:51:35 +0000
3+++ pastebinit 2014-01-29 01:36:12 +0000
4@@ -24,11 +24,11 @@
5
6 import sys
7 if sys.version[0] == "2":
8- from ConfigParser import SafeConfigParser
9+ from ConfigParser import SafeConfigParser, NoOptionError
10 from urllib import urlencode
11 from urllib import FancyURLopener
12 else:
13- from configparser import SafeConfigParser
14+ from configparser import SafeConfigParser, NoOptionError
15 from urllib.parse import urlencode
16 from urllib.request import FancyURLopener
17
18@@ -165,7 +165,10 @@
19 elif param == 'version':
20 params[paramname] = version
21 elif param == 'format':
22- params[paramname] = format
23+ try:
24+ params[paramname] = paste_config.get('defaults', 'format')
25+ except NoOptionError:
26+ params[paramname] = format
27 elif param == 'parentpid':
28 params[paramname] = doParentFixup(website, paramname,
29 parentpid)
30@@ -213,7 +216,7 @@
31 file=fd)
32 print(_("\t-a <author:default is '%s'>") % user, file=fd)
33 print(_("\t-b <pastebin url:default is '%s'>") % website, file=fd)
34- print(_("\t-f <format of paste:default is '%s'>") % format, file=fd)
35+ print(_("\t-f <format of paste:default is '%s' (or from pastebin config)>") % format, file=fd) # noqa
36 print(_("\t-h This help screen"), file=fd)
37 print(_("\t-i <input file>"), file=fd)
38 print(_("\t-l List all supported pastebins"), file=fd)

Subscribers

People subscribed via source and target branches

to all changes: