Mercurial > hg
comparison mercurial/keepalive.py @ 14764:a7d5816087a9 stable
classes: fix class style problems found by b071cd58af50
This makes test-wireprotocol.py work on Python 2.4
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 29 Jun 2011 15:00:00 +0200 |
parents | 1ffeeb91c55d |
children | fd246aefedd3 |
comparison
equal
deleted
inserted
replaced
14763:b071cd58af50 | 14764:a7d5816087a9 |
---|---|
122 import sys | 122 import sys |
123 if sys.version_info < (2, 4): | 123 if sys.version_info < (2, 4): |
124 HANDLE_ERRORS = 1 | 124 HANDLE_ERRORS = 1 |
125 else: HANDLE_ERRORS = 0 | 125 else: HANDLE_ERRORS = 0 |
126 | 126 |
127 class ConnectionManager: | 127 class ConnectionManager(object): |
128 """ | 128 """ |
129 The connection manager must be able to: | 129 The connection manager must be able to: |
130 * keep track of all existing | 130 * keep track of all existing |
131 """ | 131 """ |
132 def __init__(self): | 132 def __init__(self): |
185 if host: | 185 if host: |
186 return list(self._hostmap.get(host, [])) | 186 return list(self._hostmap.get(host, [])) |
187 else: | 187 else: |
188 return dict(self._hostmap) | 188 return dict(self._hostmap) |
189 | 189 |
190 class KeepAliveHandler: | 190 class KeepAliveHandler(object): |
191 def __init__(self): | 191 def __init__(self): |
192 self._cm = ConnectionManager() | 192 self._cm = ConnectionManager() |
193 | 193 |
194 #### Connection Management | 194 #### Connection Management |
195 def open_connections(self): | 195 def open_connections(self): |
703 return diff | 703 return diff |
704 | 704 |
705 def test_timeout(url): | 705 def test_timeout(url): |
706 global DEBUG | 706 global DEBUG |
707 dbbackup = DEBUG | 707 dbbackup = DEBUG |
708 class FakeLogger: | 708 class FakeLogger(object): |
709 def debug(self, msg, *args): | 709 def debug(self, msg, *args): |
710 print msg % args | 710 print msg % args |
711 info = warning = error = debug | 711 info = warning = error = debug |
712 DEBUG = FakeLogger() | 712 DEBUG = FakeLogger() |
713 print " fetching the file to establish a connection" | 713 print " fetching the file to establish a connection" |