i ddlZddlZddlZddlmZddlmZeedrddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZ edz Zn #e$rdZYnwxYwGdde jZGd d eZd Zd Zd ZdZdeiZedkruddlTeeZeddgZedej edeZ!e!ge_"ddl#m$Z$e$dZ%e%&dddde'ee%edSdS)N)isapicon)SimpleExtensionisapidllhandle)InternalReloadExceptionc eZdZdZdZdZdS)ReloadWatcherThreadcd|_t|_|jds|jdr|jdd|_t jt j|jdtj |_ tj |dS)NFco)change_detected__file__filenameendswith win32fileFindFirstChangeNotificationospathdirnamewin32conFILE_NOTIFY_CHANGE_LAST_WRITEhandle threadingThread__init__selfs DC:\PYTHON\_runtimes\venv\Lib\site-packages\isapi/samples/advanced.pyrzReloadWatcherThread.__init__Ns$  = ! !# & & /$-*@*@*E*E / M#2#.DM; GOODM * *   2   !!$'''''ctj|jtj} t j|jtj}tj |jn3#tj $r!}|j tj krYd}~dSd}~wwxYwtj|jtj}||krtdd|_|})Nrz+Detected file change - flagging for reload.T)rstatrST_MTIME win32eventWaitForSingleObjectrINFINITErFindNextChangeNotificationerrorwinerrorERROR_INVALID_HANDLEprintr)r last_timercdetails this_times rrunzReloadWatcherThread.runZsGDM**4=9  & 3DKATUU4T[AAAA#   #x'DDD    ..t}=II%%CDDD'+$%  &s=A**B9BBc8tj|jdSN)rFindCloseChangeNotificationrrs rstopzReloadWatcherThread.stopks-dk:::::r N)__name__ __module__ __qualname__rr0r4r rr r MsA ( ( (&&&";;;;;r r c$eZdZdZdZdZdZdS) Extensionz Python advanced sample Extensionc^t|_|jdSr2)r reload_watcherstartrs rrzExtension.__init__ts+133 !!#####r c|jjrtdt|d}|dr|d|dddtd| |d }|rh|d }td | |D].}||d }t|d|| /td| td| tdtfz| td| | tj S)Nz Doing reload UNICODE_URLReportUnhealthyzI'm a little sickz200 OKzContent-Type: text/html rz )file QUERY_STRING&z
z<no such variable>=z

zThis module has been importedz%d timesz) r<rr+rGetServerVariablerr@SendResponseHeaderssplitreload_countercloserHSE_STATUS_SUCCESS)recburlqsqueriesqvals rHttpExtensionProczExtension.HttpExtensionProcxs}   . * . ! ! !) )##M22 <<) * * 5    3 4 4 4 *KQOOO n3''''  " "> 2 2  *hhsmmG ' $ $ $ $ 0 0++A/IJJnnSnn3///// ,S ) ) ) ) -C8888 jN,,37777 S)))) **r c8|jdSr2)r<r4)rstatuss rTerminateExtensionzExtension.TerminateExtensions   """""r N)r5r6r7__doc__rrQrTr8r rr:r:qsG&&$$$+++>#####r r:ctSr2)r:r8r r__ExtensionFactory__rWs ;;r c0|jr|j|_dSdSr2) description Descriptionparamsoptionss rPreInstallDirectoryr^s*1$011r cttdtdtdtddS)NzThe sample has been installed.z+Point your browser to /AdvancedPythonSamplez2If you modify the source file and reload the page,z+you should see the reload counter incrementr+r[s r PostInstallrasM GGG *+++ 7888 >??? 788888r c$tddS)zQuery the status of somethingzEverything seems to be fine!Nr`)r]logargs rstatus_handlerres ()))))r rS__main__)*)rarg)r:FlagsAdvancedPythonSamplereplace)NamerZ ScriptMapsScriptMapUpdate PreInstall) OptionParserz --descriptionstorez3custom description to use for the virtual directory)actionhelp) opt_parsercustom_arg_handlers)(rr"sysisapir isapi.simplerhasattrwin32traceutilrrr$rr)rrH NameErrorrr r:rWr^rarerur5 isapi.installISAPIParametersr\ScriptMapParamssmVirtualDirParametersrUvd VirtualDirsoptparseroparser add_optionHandleCommandLiner8r rrs  (((((( 73 !!H))))))aNNNNN ;;;;;)*;;;H'#'#'#'#'#'#'#'#V 111999***  0 z _ 5 5 5F /Cq 1 1 1 2B   #%!&    BF%%%%%% \"  F   B 67J=sA AA