Allow server_names with and without trailing slashes.

This commit is contained in:
Georg Brandl 2010-07-16 23:10:32 +02:00
parent c59d8b6282
commit 03ab07a650

View File

@ -17,7 +17,7 @@
open_browser=true/false open_browser=true/false
encoding=fallback_charset encoding=fallback_charset
:authors: 2007-2008 Georg Brandl <georg@python.org>, :authors: 2007-2010 Georg Brandl <georg@python.org>,
2006 Armin Ronacher <armin.ronacher@active-4.com>, 2006 Armin Ronacher <armin.ronacher@active-4.com>,
2006 Matt Good <matt@matt-good.net>, 2006 Matt Good <matt@matt-good.net>,
2005 Raphael Slinckx <raphael@slinckx.net> 2005 Raphael Slinckx <raphael@slinckx.net>
@ -108,7 +108,7 @@ def get_xmlrpc_service():
import xmlrpclib import xmlrpclib
if _xmlrpc_service is None: if _xmlrpc_service is None:
try: try:
_xmlrpc_service = xmlrpclib.ServerProxy(_server_name + '/xmlrpc/', _xmlrpc_service = xmlrpclib.ServerProxy(_server_name + 'xmlrpc/',
allow_none=True) allow_none=True)
except Exception, err: except Exception, err:
fail('Could not connect to Pastebin: %s' % err, -1) fail('Could not connect to Pastebin: %s' % err, -1)
@ -286,6 +286,8 @@ def main():
# The global available server name # The global available server name
_server_name = opts.server_name _server_name = opts.server_name
if not _server_name.endswith('/'):
_server_name += '/'
# special modes of operation: # special modes of operation:
# - paste script version # - paste script version