%PDF- %PDF-
Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/ |
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/paste/reloader.pyo |
� a�Nc @ s� d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d � Z d e f d � � YZ e j j d � r� y d d l m Z Wn e k r� q� Xd e f d � � YZ n e j Z e j 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 j d | j � } | j t � | j � 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( ( s? /opt/alt/python27/lib/python2.7/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 i | _ t | _ | | _ t | j � | _ | j j | � t | j � | _ 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 ( ( s? /opt/alt/python27/lib/python2.7/site-packages/paste/reloader.pyt __init__F s c C s>