Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes
test.test_urllib2_localnet.LoopbackHttpServerThread Class Reference
Inheritance diagram for test.test_urllib2_localnet.LoopbackHttpServerThread:
Inheritance graph
[legend]
Collaboration diagram for test.test_urllib2_localnet.LoopbackHttpServerThread:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def stop
def run
def daemon
def daemon
def name
def name
def __repr__
def start
def join
def ident
def is_alive
def isDaemon
def setDaemon
def getName
def setName

Public Attributes

 ready
 httpd
 port
 daemon
 name
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

 isAlive = is_alive

Private Attributes

 _stop_server

Detailed Description

Stoppable thread that runs a loopback http server.

Definition at line 48 of file test_urllib2_localnet.py.


Constructor & Destructor Documentation

def test.test_urllib2_localnet.LoopbackHttpServerThread.__init__ (   self,
  request_handler 
)

Reimplemented from threading._Verbose.

Definition at line 51 of file test_urllib2_localnet.py.

00051 
00052     def __init__(self, request_handler):
00053         threading.Thread.__init__(self)
00054         self._stop_server = False
00055         self.ready = threading.Event()
00056         request_handler.protocol_version = "HTTP/1.0"
00057         self.httpd = LoopbackHttpServer(("127.0.0.1", 0),
00058                                         request_handler)
00059         #print "Serving HTTP on %s port %s" % (self.httpd.server_name,
00060         #                                      self.httpd.server_port)
00061         self.port = self.httpd.server_port

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def threading.Thread.__repr__ (   self) [inherited]

Definition at line 659 of file threading.py.

00659 
00660     def __repr__(self):
00661         assert self._initialized, "Thread.__init__() was not called"
00662         status = "initial"
00663         if self._started.is_set():
00664             status = "started"
00665         if self._stopped:
00666             status = "stopped"
00667         if self._daemonic:
00668             status += " daemon"
00669         if self._ident is not None:
00670             status += " %s" % self._ident
00671         return "<%s(%s, %s)>" % (self.__class__.__name__, self._name, status)

def threading.Thread.daemon (   self) [inherited]

Definition at line 894 of file threading.py.

00894 
00895     def daemon(self):
00896         assert self._initialized, "Thread.__init__() not called"
00897         return self._daemonic

def threading.Thread.daemon (   self,
  daemonic 
) [inherited]

Definition at line 899 of file threading.py.

00899 
00900     def daemon(self, daemonic):
00901         if not self._initialized:
00902             raise RuntimeError("Thread.__init__() not called")
00903         if self._started.is_set():
00904             raise RuntimeError("cannot set daemon status of active thread");
00905         self._daemonic = daemonic

def threading.Thread.getName (   self) [inherited]

Definition at line 912 of file threading.py.

00912 
00913     def getName(self):
00914         return self.name

def threading.Thread.ident (   self) [inherited]

Definition at line 883 of file threading.py.

00883 
00884     def ident(self):
00885         assert self._initialized, "Thread.__init__() not called"
00886         return self._ident

def threading.Thread.is_alive (   self) [inherited]

Definition at line 887 of file threading.py.

00887 
00888     def is_alive(self):
00889         assert self._initialized, "Thread.__init__() not called"
00890         return self._started.is_set() and not self._stopped

Here is the caller graph for this function:

def threading.Thread.isDaemon (   self) [inherited]

Definition at line 906 of file threading.py.

00906 
00907     def isDaemon(self):
00908         return self.daemon

def threading.Thread.join (   self,
  timeout = None 
) [inherited]

Reimplemented in threading._DummyThread.

Definition at line 838 of file threading.py.

00838 
00839     def join(self, timeout=None):
00840         if not self._initialized:
00841             raise RuntimeError("Thread.__init__() not called")
00842         if not self._started.is_set():
00843             raise RuntimeError("cannot join thread before it is started")
00844         if self is current_thread():
00845             raise RuntimeError("cannot join current thread")
00846 
00847         if __debug__:
00848             if not self._stopped:
00849                 self._note("%s.join(): waiting until thread stops", self)
00850 
00851         self._block.acquire()
00852         try:
00853             if timeout is None:
00854                 while not self._stopped:
00855                     self._block.wait()
00856                 if __debug__:
00857                     self._note("%s.join(): thread stopped", self)
00858             else:
00859                 deadline = _time() + timeout
00860                 while not self._stopped:
00861                     delay = deadline - _time()
00862                     if delay <= 0:
00863                         if __debug__:
00864                             self._note("%s.join(): timed out", self)
00865                         break
00866                     self._block.wait(delay)
00867                 else:
00868                     if __debug__:
00869                         self._note("%s.join(): thread stopped", self)
00870         finally:
00871             self._block.release()

Here is the call graph for this function:

Here is the caller graph for this function:

def threading.Thread.name (   self) [inherited]

Definition at line 873 of file threading.py.

00873 
00874     def name(self):
00875         assert self._initialized, "Thread.__init__() not called"
00876         return self._name

Here is the caller graph for this function:

def threading.Thread.name (   self,
  name 
) [inherited]

Definition at line 878 of file threading.py.

00878 
00879     def name(self, name):
00880         assert self._initialized, "Thread.__init__() not called"
00881         self._name = str(name)

Here is the caller graph for this function:

Reimplemented from threading.Thread.

Definition at line 71 of file test_urllib2_localnet.py.

00071 
00072     def run(self):
00073         self.ready.set()
00074         while not self._stop_server:
00075             self.httpd.handle_request()
00076 
00077 # Authentication infrastructure

Here is the caller graph for this function:

def threading.Thread.setDaemon (   self,
  daemonic 
) [inherited]

Definition at line 909 of file threading.py.

00909 
00910     def setDaemon(self, daemonic):
00911         self.daemon = daemonic

def threading.Thread.setName (   self,
  name 
) [inherited]

Definition at line 915 of file threading.py.

00915 
00916     def setName(self, name):
00917         self.name = name
00918 
00919 # The timer class was contributed by Itamar Shtull-Trauring

def threading.Thread.start (   self) [inherited]

Reimplemented in test.test_ftplib.DummyFTPServer, test.test_poplib.DummyPOP3Server, and multiprocessing.dummy.DummyProcess.

Definition at line 672 of file threading.py.

00672 
00673     def start(self):
00674         if not self._initialized:
00675             raise RuntimeError("thread.__init__() not called")
00676 
00677         if self._started.is_set():
00678             raise RuntimeError("threads can only be started once")
00679         if __debug__:
00680             self._note("%s.start(): starting thread", self)
00681         with _active_limbo_lock:
00682             _limbo[self] = self
00683         try:
00684             _start_new_thread(self._bootstrap, ())
00685         except Exception:
00686             with _active_limbo_lock:
00687                 del _limbo[self]
00688             raise
00689         self._started.wait()

Here is the call graph for this function:

Here is the caller graph for this function:

Stops the webserver if it's currently running.

Definition at line 62 of file test_urllib2_localnet.py.

00062 
00063     def stop(self):
00064         """Stops the webserver if it's currently running."""
00065 
00066         # Set the stop flag.
00067         self._stop_server = True
00068 
00069         self.join()
00070         self.httpd.server_close()

Here is the call graph for this function:


Member Data Documentation

Definition at line 53 of file test_urllib2_localnet.py.

Definition at line 56 of file test_urllib2_localnet.py.

threading.Thread.isAlive = is_alive [static, inherited]

Definition at line 891 of file threading.py.

threading.Thread.name [inherited]

Definition at line 916 of file threading.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 60 of file test_urllib2_localnet.py.

Definition at line 54 of file test_urllib2_localnet.py.


The documentation for this class was generated from the following file: