| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.6/site-packages/paste/ |
Upload File : |
Ñò
•ÊIc
@ sá d Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z d d „ Z d e f d „ ƒ YZ
e i i d ƒ oD y d d k
l Z Wn e j
o qË Xd
e
f d „ ƒ YZ n e
i Z e
i Z d S( sÊ
A file monitor and server restarter.
Use this like:
..code-block:: Python
import reloader
reloader.install()
Then make sure your server is installed with a shell script like::
err=3
while test "$err" -eq 3 ; do
python server.py
err="$?"
done
or is run from this .bat file (if you use Windows)::
@echo off
:repeat
python server.py
if %errorlevel% == 3 goto repeat
or run a monitoring process in Python (``paster serve --reload`` does
this).
Use the ``watch_file(filename)`` function to cause a reload/restart for
other other non-Python files (e.g., configuration files). If you have
a dynamic set of files that grows over time you can use something like::
def watch_config_files():
return CONFIG_FILE_CACHE.keys()
paste.reloader.add_file_callback(watch_config_files)
Then every time the reloader polls files it will call
``watch_config_files`` and check all the filenames it returns.
iÿÿÿÿN( t classinstancemethodi c C s? t d | ƒ } t i d | i ƒ } | i t ƒ | i ƒ d S( s,
Install the reloading monitor.
On some platforms server threads may not terminate when the main
thread does, causing ports to remain open/locked. The
``raise_keyboard_interrupt`` option creates a unignorable signal
which causes the whole application to shut-down (rudely).
t
poll_intervalt targetN( t Monitort threadingt Threadt periodic_reloadt setDaemont Truet start( R t mont t( ( s2 /usr/lib/python2.6/site-packages/paste/reloader.pyt install2 s
R c B s_ e Z g Z g Z g Z d „ Z d „ Z d „ Z d „ Z e e ƒ Z d „ Z
e e
ƒ Z
RS( c C sS h | _ t | _ | | _ t | i ƒ | _ | i i | ƒ t | i ƒ | _
d S( N( t
module_mtimesR t keep_runningR t listt global_extra_filest extra_filest instancest appendt global_file_callbackst file_callbacks( t selfR ( ( s2 /usr/lib/python2.6/site-packages/paste/reloader.pyt __init__F s c C sB x; t o3 | i ƒ p t i d ƒ Pn t i | i ƒ q Wd S( Ni ( R t check_reloadt ost _exitt timet sleepR ( R ( ( s2 /usr/lib/python2.6/site-packages/paste/reloader.pyR N s
c C s
t | i ƒ } xJ | i D]? } y | i | ƒ ƒ Wq t i d | IJt i ƒ q Xq Wxc t i i ƒ D]R } y
| i
} Wn t t f j
o } ql n X| d j o | i | ƒ ql ql WxD| D]<} y- t i | ƒ } | o
| i } n d } Wn t t f j
o
qÉ n X| i d ƒ o: t i i | d ƒ o# t t i | d ƒ i | ƒ } nS | i d ƒ oB t i i | d d ƒ o' t t i | d d ƒ i | ƒ } n | i i | ƒ p | | i | <qÉ | i | | j o t i d | IJt SqÉ Wt S( Ns) Error calling paste.reloader callback %r:i s .pyciÿÿÿÿs $py.classi÷ÿÿÿs .pys %s changed; reloading...( R R R t extendt syst stderrt tracebackt print_exct modulest valuest __file__t AttributeErrort ImportErrort NoneR R t statt st_mtimet OSErrort IOErrort endswitht patht existst maxR
t has_keyt FalseR ( R t filenamest
file_callbackt modulet filenamet excR( t mtime( ( s2 /usr/lib/python2.6/site-packages/paste/reloader.pyR Z sJ
'#'
c C sh t i i | ƒ } | d j o5 x | i D] } | i | ƒ q) W| i i | ƒ n | i i | ƒ d S( s Watch the named file for changesN( R R- t abspathR' R t
watch_fileR R R ( R t clsR5 t instance( ( s2 /usr/lib/python2.6/site-packages/paste/reloader.pyR9 s
c C sV | d j o5 x | i D] } | i | ƒ q W| i i | ƒ n | i i | ƒ d S( s{ Add a callback -- a function that takes no parameters -- that will
return a list of filenames to watch for changes.N( R' R t add_file_callbackR R R ( R R: t callbackR; ( ( s2 /usr/lib/python2.6/site-packages/paste/reloader.pyR<