| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b2e0c4a commit 6367a85
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,7 +113,10 @@ def buildProtocol(self, addr): | |||
| 113 | 113 | return EvalProtocol(self.repl) | |
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | - if urwid.VERSION < (1, 0, 0): | ||
| 116 | + # If Twisted is not available urwid has no TwistedEventLoop attribute. | ||
| 117 | + # Code below will try to import reactor before using TwistedEventLoop. | ||
| 118 | + # I assume TwistedEventLoop will be available if that import succeeds. | ||
| 119 | + if urwid.VERSION < (1, 0, 0) and hasattr(urwid, 'TwistedEventLoop'): | ||
| 117 | 120 | class TwistedEventLoop(urwid.TwistedEventLoop): | |
| 118 | 121 | ||
| 119 | 122 | """TwistedEventLoop modified to properly stop the reactor. | |
@@ -144,7 +147,7 @@ def wrapper(*args, **kwargs): | |||
| 144 | 147 | self.reactor.crash() | |
| 145 | 148 | return wrapper | |
| 146 | 149 | else: | |
| 147 | - TwistedEventLoop = urwid.TwistedEventLoop | ||
| 150 | + TwistedEventLoop = getattr(urwid, 'TwistedEventLoop', None) | ||
| 148 | 151 | ||
| 149 | 152 | ||
| 150 | 153 | class StatusbarEdit(urwid.Edit): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments