File tree Expand file tree Collapse file tree
Open diff view settings
Expand file tree Collapse file tree
Open diff view settings
Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ def loadini(struct, configfile):
4444 'paste_time' : 0.02 ,
4545 'syntax' : True ,
4646 'tab_length' : 4 ,
47- 'pastebin_url' : 'http://bpaste.net' },
47+ 'pastebin_url' : 'http://bpaste.net/xmlrpc/' ,
48+ 'pastebin_show_url' : 'http://bpaste.net/show/$paste_id/' ,
49+ },
4850 'keyboard' : {
4951 'clear_line' : 'C-u' ,
5052 'clear_screen' : 'C-l' ,
@@ -87,6 +89,7 @@ def loadini(struct, configfile):
8789 struct .last_output_key = config .get ('keyboard' , 'last_output' )
8890
8991 struct .pastebin_url = config .get ('general' , 'pastebin_url' )
92+ struct .pastebin_show_url = config .get ('general' , 'pastebin_show_url' )
9093
9194 color_scheme_name = config .get ('general' , 'color_scheme' )
9295
Original file line number Diff line number Diff line change 3535from glob import glob
3636from itertools import takewhile
3737from locale import getpreferredencoding
38- from urlparse import urljoin
38+ from string import Template
39+ from urllib import quote as urlquote
3940from xmlrpclib import ServerProxy , Error as XMLRPCError
4041
4142from pygments .lexers import PythonLexer
@@ -589,8 +590,7 @@ def write2file(self):
589590 def pastebin (self ):
590591 """Upload to a pastebin and display the URL in the status bar."""
591592
592- pasteservice_url = OPTS .pastebin_url
593- pasteservice = ServerProxy (urljoin (pasteservice_url , '/xmlrpc/' ))
593+ pasteservice = ServerProxy (OPTS .pastebin_url )
594594
595595 s = self .getstdout ()
596596
@@ -601,7 +601,9 @@ def pastebin(self):
601601 self .statusbar .message ('Upload failed: %s' % (str (e ), ) )
602602 return
603603
604- paste_url = urljoin (pasteservice_url , '/show/%s/' % (paste_id , ))
604+ paste_url_template = Template (OPTS .pastebin_show_url )
605+ paste_id = urlquote (paste_id )
606+ paste_url = paste_url_template .safe_substitute (paste_id = paste_id )
605607 self .statusbar .message ('Pastebin URL: %s' % (paste_url , ), 10 )
606608
607609 def make_list (self , items ):
You can’t perform that action at this time.
0 commit comments