All pastes #1573324 Raw Edit

Miscellany

public text v1 · immutable
#1573324 ·published 2009-09-20 21:55 UTC
rendered paste body
commit 7250c69cef7273dc2e4dadd953e03c412464a576Author: Niels de Vos <niels@nixpanic.net>Date:   Sun Sep 20 22:50:18 2009 +0100    Add an option for passing an alternative pastebin        This patch adds the option '-u URL' to change the default pastbin from    http://fpaste.org to something else.        Signed-off-by: Niels de Vos <nixpanic@users.sourceforge.net>diff --git a/fpaste b/fpasteindex 9a8d30c..dd2b817 100755--- a/fpaste+++ b/fpaste@@ -88,7 +88,7 @@ def paste(text, options):         if not confirm("Send binary data anyway?"):             return False -    req = urllib2.Request(url='http://fpaste.org/', data=params, headers={'User-agent': USER_AGENT})+    req = urllib2.Request(url=options.url, data=params, headers={'User-agent': USER_AGENT})     if options.proxy:         if options.debug:             print >> sys.stderr, "Using proxy: %s" % options.proxy@@ -112,7 +112,7 @@ def paste(text, options):     url = f.geturl()     # minimally validate the returned url, as it is sometimes just "http://fpaste.org/" VS "http://fpaste.org/????/" without hitting an error above     #if re.match('http://fpaste.org/?[a-zA-Z0-9]+/?$', url):-    if re.match('http://fpaste.org/?.+', url):+    if re.match(options.url + '/?.+', url):         return url     else:         print >> sys.stderr, "Invalid fpaste URL '%s' returned. This should not happen. Use --debug to see server output" % url@@ -218,7 +218,7 @@ def main():      usage = """\ Usage: %prog [OPTION]... [FILE]...-  send text file(s), stdin, or clipboard to the http://fpaste.org pastebin and return the URL.+  send text file(s), stdin, or clipboard to a pastebin like http://fpaste.org and return the URL.  Examples:   %prog file1.txt file2.txt@@ -230,6 +230,7 @@ Examples:     parser = OptionParser(usage=usage, version='%prog '+VERSION)     parser.add_option('', '--debug', dest='debug', help=SUPPRESS_HELP, action="store_true", default=False)     parser.add_option('', '--proxy', dest='proxy', help=SUPPRESS_HELP)+    parser.add_option('-u', dest='url', help='the URL of the pastebin to use', default='http://fpaste.org', metavar='"URL"')      # pastebin-specific options first     fpasteOrg_group = OptionGroup(parser, "fpaste.org Options")