~tribaal/txaws/xss-hardening

« back to all changes in this revision

Viewing changes to txaws/reactor.py

  • Committer: Duncan McGreggor
  • Date: 2009-11-22 02:20:42 UTC
  • mto: (44.3.2 484858-s3-scripts)
  • mto: This revision was merged to the branch mainline in revision 52.
  • Revision ID: duncan@canonical.com-20091122022042-4zi231hxni1z53xd
* Updated the LICENSE file with copyright information.
* Updated the README with license information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
'''Reactor utilities.'''
2
 
 
3
 
 
4
 
def get_exitcode_reactor():
5
 
    """
6
 
    This is only neccesary until a fix like the one outlined here is
7
 
    implemented for Twisted:
8
 
        http://twistedmatrix.com/trac/ticket/2182
9
 
    """
10
 
    from twisted.internet.main import installReactor
11
 
    from twisted.internet.selectreactor import SelectReactor
12
 
 
13
 
    class ExitCodeReactor(SelectReactor):
14
 
 
15
 
        def stop(self, exitStatus=0):
16
 
            super(ExitCodeReactor, self).stop()
17
 
            self.exitStatus = exitStatus
18
 
 
19
 
        def run(self, *args, **kwargs):
20
 
            super(ExitCodeReactor, self).run(*args, **kwargs)
21
 
            return self.exitStatus
22
 
 
23
 
    reactor = ExitCodeReactor()
24
 
    installReactor(reactor)
25
 
    return reactor
26
 
 
27
 
 
28
 
try:
29
 
    reactor = get_exitcode_reactor()
30
 
except:
31
 
    from twisted.internet import reactor