| 20 | | serverconfig = component.getUtility(IDebugServerConfiguration, |
|---|
| 21 | | config.serverType, context=site) |
|---|
| | 27 | serverconfig = component.queryUtility(IDebugServerConfiguration, |
|---|
| | 28 | config.serverType, context=site) |
|---|
| | 29 | if not serverconfig: |
|---|
| | 30 | raise DebugServerStartError( |
|---|
| | 31 | _(u'debugserver-config-not-found' |
|---|
| | 32 | u'Could not find any configuration for the ${serverType} ' |
|---|
| | 33 | u'debug server', dict(serverType=config.serverType))) |
|---|
| | 34 | |
|---|
| 23 | | serverFactory = component.getUtility(IDebugServerFactory, |
|---|
| 24 | | config.serverType) |
|---|
| 25 | | self.debugger = debuggerFactory(config) |
|---|
| | 36 | serverFactory = component.queryUtility(IDebugServerFactory, |
|---|
| | 37 | config.serverType) |
|---|
| | 38 | if not serverFactory: |
|---|
| | 39 | raise DebugServerStartError( |
|---|
| | 40 | _(u'debugserver-factory-not-found' |
|---|
| | 41 | u'Could not find a factory for the ${serverType} ' |
|---|
| | 42 | u'debug server', dict(serverType=config.serverType))) |
|---|
| | 43 | |
|---|
| | 44 | try: |
|---|
| | 45 | self.debugger = debuggerFactory(config) |
|---|
| | 46 | except RuntimeError, exception: |
|---|
| | 47 | raise DebugServerStartError(_(u'wingdebug-already-running', |
|---|
| | 48 | unicode(exception))) |
|---|
| | 49 | except ValueError: |
|---|
| | 50 | raise DebugServerStartError(_( |
|---|
| | 51 | u'winghome-incorrect', |
|---|
| | 52 | u'The Wing debug libraries could not be loaded, please verify ' |
|---|
| | 53 | u'your configured Wing Home')) |
|---|
| | 54 | |
|---|
| 41 | | self.server.runInDebugContext(self.debugger.connectClient) |
|---|
| | 70 | |
|---|
| | 71 | connected = [] |
|---|
| | 72 | def connectClient(): |
|---|
| | 73 | self.debugger.connectClient() |
|---|
| | 74 | connected.append(self.debugger.clientConnected) |
|---|
| | 75 | self.server.runInDebugContext(connectClient) |
|---|
| | 76 | |
|---|
| | 77 | # time out the call, up to 5 seconds |
|---|
| | 78 | timeout = time.time() + 5 |
|---|
| | 79 | while time.time() < timeout and not connected: |
|---|
| | 80 | time.sleep(0.05) |
|---|
| | 81 | if not connected or not connected[0]: |
|---|
| | 82 | message = _(u'ide-connection-failure', |
|---|
| | 83 | u'Failed to connect to the IDE. Check your IDE host ' |
|---|
| | 84 | u'and port are correct.') |
|---|
| | 85 | if connected: |
|---|
| | 86 | message = _(u'ide-connection-timeout', |
|---|
| | 87 | u'Connection to IDE timed out') |
|---|
| | 88 | raise IDEConnectionError(message) |
|---|