← Back to team overview

txaws-dev team mailing list archive

[Merge] lp:~lifeless/txaws/client into lp:txaws

 

Robert Collins has proposed merging lp:~lifeless/txaws/client into lp:txaws.

Requested reviews:
    txAWS Developers (txaws-dev)

Recent changes broke bin/aws-status, by importing both directly and indirectly twisted.internet.

Sadly, twisted's reactor management is broken-by-default, so we have to be ugly to compensate.
-- 
https://code.launchpad.net/~lifeless/txaws/client/+merge/11943
Your team txAWS Developers is subscribed to branch lp:txaws.
=== modified file 'txaws/client/gui/gtk.py'
--- txaws/client/gui/gtk.py	2009-08-28 20:09:37 +0000
+++ txaws/client/gui/gtk.py	2009-09-17 02:47:34 +0000
@@ -8,10 +8,11 @@
 import gobject
 import gtk
 
-from twisted.internet.defer import TimeoutError 
+# DO NOT IMPORT twisted.internet, or things that import
+# twisted.internet.
+# Doing so loads the default Reactor, which is bad. thanks.
 
 from txaws.credentials import AWSCredentials
-from txaws.service import AWSServiceRegion
 
 
 __all__ = ['main']
@@ -21,6 +22,7 @@
     """A status icon shown when instances are running."""
 
     def __init__(self, reactor):
+        from txaws.service import AWSServiceRegion
         gtk.StatusIcon.__init__(self)
         self.set_from_stock(gtk.STOCK_NETWORK)
         self.set_visible(True)
@@ -176,6 +178,7 @@
             pass
 
     def describe_error(self, error):
+        from twisted.internet.defer import TimeoutError
         if isinstance(error.value, TimeoutError):
             # timeout errors can be ignored - transient network issue or some
             # such.

=== modified file 'txaws/service.py'
--- txaws/service.py	2009-08-28 20:07:55 +0000
+++ txaws/service.py	2009-09-17 02:47:34 +0000
@@ -2,6 +2,8 @@
 # Copyright (C) 2009 Robert Collins <robertc@xxxxxxxxxxxxxxxxx>
 # Licenced under the txaws licence available at /LICENSE in the txaws source.
 
+# NB: This installs a reactor. If debugging why a reactor is installed, don't
+# import txaws.service before setting your reactor.
 from twisted.web.client import _parse
 
 from txaws.credentials import AWSCredentials