This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2gobroker. from 3652b8c fix for last commit new 67b9140 more consolidation for split_host_address() function The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: x2gobroker/tests/test_utils.py | 5 +++++ x2gobroker/utils.py | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit 67b9140f22f8191b3e30fe9a25e690577c5d97e1 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue Oct 28 18:32:06 2014 +0100 more consolidation for split_host_address() function --- x2gobroker/tests/test_utils.py | 5 +++++ x2gobroker/utils.py | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/x2gobroker/tests/test_utils.py b/x2gobroker/tests/test_utils.py index 4de9b1b..3335f81 100644 --- a/x2gobroker/tests/test_utils.py +++ b/x2gobroker/tests/test_utils.py @@ -163,6 +163,11 @@ class TestX2GoBrokerUtils(unittest.TestCase): bind_address, bind_port = x2gobroker.utils.split_host_address(host, default_address, default_port) self.assertEqual((bind_address, bind_port), (host, default_port)) + host = '' + default_address = '' + default_port = 8080 + bind_address, bind_port = x2gobroker.utils.split_host_address(host, default_address, default_port) + self.assertEqual((bind_address, bind_port), ('0.0.0.0', default_port)) def test_suite(): from unittest import TestSuite, makeSuite diff --git a/x2gobroker/utils.py b/x2gobroker/utils.py index a7cb75a..002feb5 100644 --- a/x2gobroker/utils.py +++ b/x2gobroker/utils.py @@ -204,7 +204,7 @@ def split_host_address(host, default_address=None, default_port=22): bind_port = None is_ipv6 = None - if host[0] == '[': + if host and host[0] == '[': is_ipv6 = True if ':' in host: @@ -220,7 +220,10 @@ def split_host_address(host, default_address=None, default_port=22): # in host we find a port number only bind_port = int(host) except ValueError: - bind_address = host + if host: + bind_address = host + else: + bind_address = '0.0.0.0' if type(default_port) is types.IntType: # use the given default, in host, there is an IP address or hostname bind_port = default_port -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git