From 30c6341d42d83c61f983b40971f794f7866fc5c5 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 10 Nov 2010 00:08:17 +0100 Subject: [PATCH 1/5] Added build and dist dire to gitignore (both created by setuptools). --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7fdea58..2585b12 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.pyc *.egg-info +build +dist \ No newline at end of file From ddef20da5df9582b3ea38449b6b42dbbece3baa6 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 10 Nov 2010 00:25:12 +0100 Subject: [PATCH 2/5] Added --cbtrailingslash option that appends a slash to the callback URL. Useful for cases in which the target framework enforces trailing slashes with a redirect. --- hookbox/config.py | 5 +++++ hookbox/server.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/hookbox/config.py b/hookbox/config.py index 304288f..51d68d0 100644 --- a/hookbox/config.py +++ b/hookbox/config.py @@ -86,6 +86,10 @@ def _add_callback_interface_options(self, parser, defaults): dest="cbhttps", action="store_true", default=defaults._cbhttps, metavar="HTTPS", help="Use https (instead of http) to make callbacks.") + parser.add_option("--cbtrailingslash", + dest="cbtrailingslash", action="store_true", + default=defaults._cbtrailingslash, + help="Append a trailing slash to the callback URL.") def _add_callback_path_options(self, parser, defaults): parser.add_option('--cb-connect', @@ -162,6 +166,7 @@ class HookboxConfig(object): defaults._cookie_identifier = NoDefault() defaults._webhook_secret = NoDefault() defaults._cbhttps = False + defaults._cbtrailingslash = False defaults._cb_connect = 'connect' defaults._cb_disconnect = 'disconnect' defaults._cb_create_channel = 'create_channel' diff --git a/hookbox/server.py b/hookbox/server.py index 655909b..f70589b 100644 --- a/hookbox/server.py +++ b/hookbox/server.py @@ -162,6 +162,8 @@ def http_request(self, path_name=None, cookie_string=None, form={}, full_path=No host = u.hostname port = u.port or 80 path = u.path + if self.config['cbtrailingslash'] and not path.endswith('/'): + path += '/' if u.query: path += '?' + u.query else: @@ -170,6 +172,8 @@ def http_request(self, path_name=None, cookie_string=None, form={}, full_path=No # host = self.base_host # else: path = self.base_path + '/' + self.config.get('cb_' + path_name) + if self.config['cbtrailingslash'] and not path.endswith('/'): + path += '/' scheme = self.config["cbhttps"] and "https" or "http" host = self.config["cbhost"] port = self.config["cbport"] From 371c1aadc23348764e08dd88cf23cc85fa075485 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Wed, 10 Nov 2010 00:25:22 +0100 Subject: [PATCH 3/5] Minor cleanup while I'm here. --- hookbox/server.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/hookbox/server.py b/hookbox/server.py index f70589b..a29f79b 100644 --- a/hookbox/server.py +++ b/hookbox/server.py @@ -158,10 +158,7 @@ def http_request(self, path_name=None, cookie_string=None, form={}, full_path=No full_path = self.config['cb_single_url'] if full_path: u = urlparse.urlparse(full_path) - scheme = u.scheme - host = u.hostname - port = u.port or 80 - path = u.path + scheme, host, port, path = u.scheme, u.hostname, u.port or 80, u.path if self.config['cbtrailingslash'] and not path.endswith('/'): path += '/' if u.query: @@ -198,11 +195,9 @@ def http_request(self, path_name=None, cookie_string=None, form={}, full_path=No # for logging if port != 80: - url = urlparse.urlunparse((scheme,host + ":" + str(port), '', '','','')) - else: - url = urlparse.urlunparse((scheme,host, '', '','','')) - - + host = "%s:%s" % (host, port) + url = urlparse.urlunparse((scheme, host, '', '', '', '')) + headers = {'content-type': 'application/x-www-form-urlencoded'} if cookie_string: headers['Cookie'] = cookie_string From d6147019d6a5adf366b88518ae0c28e33a6a681d Mon Sep 17 00:00:00 2001 From: Marcin Lulek Date: Mon, 27 Dec 2010 21:56:55 +0100 Subject: [PATCH 4/5] auto_subscribe is missing as one of options - thus preventing user auto_subscribing --- hookbox/user.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hookbox/user.py b/hookbox/user.py index 254b796..30c46ba 100644 --- a/hookbox/user.py +++ b/hookbox/user.py @@ -13,6 +13,7 @@ class User(object): _options = { 'reflective': True, 'moderated_message': True, + 'auto_subscribe':[] } def __init__(self, server, name, **options): From e68023574b392ca7b781030f0dc6d74bf2c3ec72 Mon Sep 17 00:00:00 2001 From: Marcin Lulek Date: Fri, 7 Jan 2011 14:54:46 +0100 Subject: [PATCH 5/5] updated gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7fdea58..fa02bd9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.pyc *.egg-info +/.project +/.pydevproject