Commits

Steve Losh committed 1125e72

Clean up the dpaste handler code a bit.

I didn't know urlencode would take a straight dictionary.

Comments (0)

Files changed (1)

 
 
 def _paste_dpaste(content, **parameters):
-    data = [('content', content), ('language', 'Diff')]
+    data = {'content': content, 'language': 'Diff'}
     if parameters['title']:
-        data.append(('title', parameters['title']),)
+        data['title'] = parameters['title']
     if parameters['user']:
-        data.append(('poster', parameters['user']),)
+        data['poster'] = parameters['user']
     if parameters['keep']:
-        data.append(('hold', 'on'),)
+        data['hold'] = 'on'
     data = urlencode(data)
     
     request = urllib2.Request(pastebins['dpaste']['url'], data)
         data['title'] = parameters['title']
     if parameters['user']:
         data['author'] = parameters['user']
+    
     # Same values used in dpaste.org form for default (a month) and forever expires.
     data['expire_options'] = '3110400000' if parameters['keep'] else '2592000'
     data = urlencode(data)