ó aňNc@sÝdZddlZddlZddlZddlZddlZddlmZdd„Zde fd„ƒYZ ej j dƒrÇydd l mZWnek r­qÇXd e fd „ƒYZne jZe jZdS( 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(tclassinstancemethodicCs?td|ƒ}tjd|jƒ}|jtƒ|jƒdS(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_intervalttargetN(tMonitort threadingtThreadtperiodic_reloadt setDaemontTruetstart(Rtmontt((s?/opt/alt/python27/lib/python2.7/site-packages/paste/reloader.pytinstall2s  RcBs_eZgZgZgZd„Zd„Zd„Zd„Ze eƒZd„Z e e ƒZ RS(cCsSi|_t|_||_t|jƒ|_|jj|ƒt|j ƒ|_ dS(N( t module_mtimesRt keep_runningRtlisttglobal_extra_filest extra_filest instancestappendtglobal_file_callbackstfile_callbacks(tselfR((s?/opt/alt/python27/lib/python2.7/site-packages/paste/reloader.pyt__init__Fs    cCs>x7tr9|jƒs&tjdƒPntj|jƒqWdS(Ni(Rt check_reloadtost_exitttimetsleepR(R((s?/opt/alt/python27/lib/python2.7/site-packages/paste/reloader.pyRNs    cCsűt|jƒ}xJ|jD]?}y|j|ƒƒWqtjd|IJtjƒqXqWx_tjj ƒD]N}y |j }Wnt t fk r}qlnX|dk rl|j|ƒqlqlWx6|D].}y+tj|ƒ}|rď|j}nd}Wnttfk rqĹnX|jdƒrZtjj|d ƒrZttj|d ƒj|ƒ}nO|jdƒrŠtjj|d dƒrŠttj|d dƒj|ƒ}n|jj|ƒsË||j|R?t__doc__R(((s?/opt/alt/python27/lib/python2.7/site-packages/paste/reloader.pyRBs (RCRRRRR tpaste.util.classinstanceRR tobjectRtplatformt startswitht_systemrestartRAR&RBR9R<(((s?/opt/alt/python27/lib/python2.7/site-packages/paste/reloader.pyt)s       W