Skip to content

Commit

Permalink
Show url of active paste bin in confirmation. Completes robcowie#6
Browse files Browse the repository at this point in the history
  • Loading branch information
robcowie committed Oct 23, 2011
1 parent c2b3022 commit 108fdab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Pastebin.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def run(self, edit):
if not self.settings.get('prompt_on_post', True):
self.go()
else:
msg = 'post snippet to %s? [y/n]' % self.paster.url()
self.window.show_input_panel(
'Confirm post snippet? [y/n]', 'y', self.go, None, None)
msg, 'y', self.go, None, None)
except Exception, exc:
self.status(str(exc))

Expand Down
3 changes: 3 additions & 0 deletions src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def __init__(self, view):
self.view = view
self.config = self.view.settings().get('pastebin')

def url(self):
return self.config.get('url')

def prepare(self, content):
return content.encode('utf8')

Expand Down
6 changes: 5 additions & 1 deletion src/dpaste.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class Dpaste(api.PastebinImplementation):
'plaintext' : ''
}

def url(self):
print self.config.get('url')
return self.config.get('url') or 'http://dpaste.com/'

def upload(self, content):
params = urllib.urlencode({
'content': content,
Expand All @@ -49,7 +53,7 @@ def upload(self, content):

def fetch(self, paste_id):
# dpaste_to_subl_lang = dict((v, k) for k, v in self.SYNTAXES.iteritems())
url = 'http://dpaste.com/%s/plain/' % paste_id
url = '%s%s/plain/' % (self.url(), paste_id)
try:
req = urllib2.Request(url)
response = urllib2.urlopen(req)
Expand Down
2 changes: 1 addition & 1 deletion src/lodgeit.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Lodgeit(api.PastebinImplementation):
def __init__(self, view):
super(Lodgeit, self).__init__(view)
self.pastebin = lodgeitlib.Lodgeit(
self.config.get('url'),
self.url(),
username=self.config.get('username'),
password=self.config.get('password')
)
Expand Down

0 comments on commit 108fdab

Please sign in to comment.