mò á¸Ec@sdZdkZdkZdkZdkZdklZdklZydkZ e Z Wne j o e Z nXdk Z dklZeidƒZead„Zd„Zdfd „ƒYZd efd „ƒYZd efd „ƒYZd„Zd„Zedƒid„ZdS(sA Startup package. Responsible for startup configuration of Zope N(scompile(s gethostbyaddr(s loghandlertZopecCs7tƒtid iƒdjo tƒSntƒSdS(Nitwin(tcheck_python_versiontsystplatformtlowertWindowsZopeStartertUnixZopeStarter(((t5/data/zmath/zope/lib/python/Zope2/Startup/__init__.pyt get_starter$s cCsQtodSntƒ}|i|ƒ|iƒtaz|iƒWdtaXdS(s<The function called by run.py which starts a Zope appserver.N( tstartedR tstartertsetConfigurationtcfgtpreparetTruetruntFalse(R t debug_handlerR ((Rt start_zope+s   t ZopeStartercBsÝtZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s`This is a class which starts a Zope server. Making it a class makes it easier to test. cCsŒtiƒ|_tiddƒ}tiƒ|_|ii |ƒ|ii ti ƒti ƒ|_ |ii|iƒ|ii|i ƒdS(Ns.%(asctime)s %(levelname)s %(name)s %(message)ss%Y-%m-%d %H:%M:%S(tloggingt getLoggertselft event_loggert Formattert formattert loghandlert StreamHandlerRt setFormattertsetLeveltWARNtStartupHandlertstartup_handlert addHandler(RR((Rt__init__Bs  cCs ||_dS(N(R R(RR ((RR UscCs·|iƒ|iƒ|iƒ|iƒ|iƒ|iƒ|iƒ|iƒ|i ƒ|i ƒ|i ƒdk l }|ƒ}|ip|iƒntidƒ|iƒdS(N(sgetConfigurationsReady to handle requests(RtsetupInitialLoggingt setupLocaletsetupSecurityOptionstsetupPublishert setupZServert setupServerstdropPrivilegest makeLockFilet makePidFiletsetupInterpretert startZopet App.configtgetConfigurationtconfigttwisted_serverstregisterSignalstloggertinfotsetupFinalLogging(RR1R0((RRXs"               cCsÇzµdkl}|ƒ}dk}|io|iotidƒ‚n|io>tptidƒ‚nt i i i ƒt i|iƒn$dk}|iƒt i|iƒWd|iƒXdS(N(sgetConfigurations7You can't run both ZServer servers and twisted servers.s"You do not have twisted installed.(R/R0R1tZServerR2tserverstZConfigtConfigurationErrort _use_twistedttwistedtinternettreactorRRtexitt exit_codetLifetimetloopRtshutdown(RR0R7RAR1((RRqs       cCs|iƒ|iƒdS(N(RtunlinkLockFilet unlinkPidFile(R((RRC‰s cCsti|ƒdS(N(R4R5tmsg(RRF((RR5scCsti|ƒdS(N(R4tcriticalRF(RRF((Rtpanic’scCsti|ƒdS(N(R4terrorRF(RRF((RRI•scCsÚdk}dk}dk}|ii|_|ii |iiƒ|ii |ii ƒ|ii o |ii }|ii|ƒn|iioFg}x'|iiD]}|it|ƒƒq£Wt|ƒ|i_ndS(N(tGlobalstZPublisher.HTTPRequestt ZPublishertZPublisher.PublishRR t debug_modetDevelopmentModetPublishtset_default_debug_modet set_default_authentication_realmt http_realmtpublisher_profile_filetfilenametinstall_profilingttrusted_proxiestmappedtnametextendt _name2Ipsttuplet HTTPRequest(RRLRYRURJRX((RR'˜s       cCsGdk}|i|iiƒ|i|ii |ii |iiƒdS(N( t AccessControltsetImplementationRR tsecurity_policy_implementationtsetDefaultBehaviorstskip_ownership_checkingtskip_authentication_checkingtverbose_security(RR^((RR&©s   cCs¨|iipdSndk}|idƒ}|ii}|dj o^y dk}Wnti dƒ‚nXy|i |i |ƒWq¤ti d|ƒ‚q¤XndS(Ns iso-8859-1s—The locale module could not be imported. To use localization options, you must ensure that the locale module is compiled into your Python installation.s‰The specified locale "%s" is not supported by yoursystem. See your operating system documentation for more information on locale support.( RR tlocaletcodecstlookuptdummyt locale_idtNoneR9R:t setlocaletLC_ALL(RRhReRiRf((RR%²s     cCs/dk}|i|iiƒ|ii|_dS(N(R7tsetNumberOfThreadsRR tzserver_threadstmax_listen_socketstCONNECTION_LIMIT(RR7((RR(Ðs cCsˆd}g}xi|iiD][}y|i|iƒƒWqtij o,}t i ||i ƒ|dfƒ‚qXqW||i_dS(NsÞThere was a problem starting a server of type "%s". This may mean that your user does not have permission to bind to the port which the server is trying to use or the port may already be in use by another application. (%s)i( t socket_errR8RR tservertappendtcreatetsocketRIteR9R:t servertype(RRvRqRrR8((RR)Ös ,cCs t|iƒS(N(R*RR (R((RR*éscCs6|iidjo ti}n|iiiƒ}|S(N(RR teventlogRjRtINFOtleveltgetLowestHandlerLevel(RRz((RtgetLoggingLevelìs cCsõ|ii|iƒ|iiodSn|iidj o|iiƒn|iidj o|iiƒn|ii dj o|ii ƒn|ii o=|ii|i ƒ|ii |iƒ|ii |i ƒn|ii |iƒdS(N(RRt removeHandlerR!R tzserver_read_only_modeRxRjtaccessttraceRNRt flushBufferToR"(R((RtsetupConfiguredLoggersös  cCsG|iio|ii|iƒƒn|ii|iƒd|_dS(N( RR RNRRR|RR}Rj(R((RR$ s cCsdk}|iƒdS(N(tZope2tstartup(RRƒ((RR.s cCs´|iip£dkl}|ii}yptii|ƒoti |ƒnt |dƒ|_ ||i ƒ|i i t tiƒƒƒ|i iƒWq°tj oq°XndS(N(s lock_filetw(RR R~tZope2.Startup.misc.lock_filet lock_filet lock_filenametostpathtexiststunlinktopentlockfiletwritetstrtgetpidtflushtIOError(RR‡Rˆ((RR+s   cCs—|iip†yltii|iiƒoti|iiƒnt|iidƒ}|i t ti ƒƒƒ|i ƒWq“tj oq“XndS(NR…(RR R~R‰RŠR‹t pid_filenameRŒRtfRRR‘tcloseR“(RR•((RR,1s cCsB|iip1yti|iiƒWq>tj oq>XndS(N(RR R~R‰RŒR”tOSError(R((RRE=s  cCsO|iip>y$|iiƒti|iiƒWqKtj oqKXndS(N( RR R~RŽR–R‰RŒRˆR—(R((RRDDs   cCsti|iiƒdS(s4 make changes to the python interpreter environment N(RtsetcheckintervalRR tpython_check_interval(R((RR-Ls(t__name__t __module__t__doc__R#R RRRCR5RHRIR'R&R%R(R)R*R|R‚R$R.R+R,RERDR-(((RR=s0                    RcBs#tZd„Zd„Zd„ZRS(NcCs9dkl}|i|ii|ii|iigƒdS(N(sSignals(tSignalstregisterZopeSignalsRR RxRR€(RR((RR3Ss cCsti|ƒ|iƒdS(N(RR$RR‚(R((RR$Ys cCsdS(N((R((RR6]s(RšR›R3R$R6(((RRQs  RcBs#tZd„Zd„Zd„ZRS(NcCs9dkl}|i|ii|ii|iigƒdS(N(sSignals(RRžRR RxRR€(RR((RR3cs cCs=ti|ƒ|iƒ}|ii|ƒ|ii|ƒdS(N(RR$RR|RzR!RR(RRz((RR$is  cCs|iƒdS(N(RR‚(R((RR6ss(RšR›R3R$R6(((RRas  cCsGtiiƒd}d}|djotid||fƒ‚ndS(Nis2.3.4s?Invalid python version: %s, the optimal version is %s or higher(Rtversiontsplittpython_versiontoptimum_versionR9R:(R¡R¢((RRws cCsòtidjodSntiƒdjodSndk}|i}|djo&d}ti |ƒt i |ƒ‚nyt |ƒ}Wnltj o`y|i|ƒ}Wn9tj o-d|}ti|ƒt i |ƒ‚nX|d}nQXy|i|ƒ}Wn9tj o-d|}ti|ƒt i |ƒ‚nX|d}|djo&d}ti|ƒt i |ƒ‚ny*dk}|i||ƒti|ƒWn tj otid ƒnXti|ƒtid |ƒd S( NtposixissA user was not specified to setuid to; fix this to start as root (change the effective-user directive in zope.conf)sCan't find username %risCan't find uid %ris:Cannot start Zope with the effective user as the root users(Could not set group id of effective usersSet effective user to "%s"i(R‰RYtgetuidtpwdR teffective_userRjRFR4RGR9R:tinttuidt ValueErrortgetpwnamtpwrectKeyErrorRItgetpwuidtgidt initgroupstsetgidR—t exceptiontsetuidR5(R R¨R¯R¥R®R«RFR¦((RR*sP             s (\d+\.){3}cCs&||ƒo |gSnt|ƒdS(sïmap a name *host* to the sequence of its ip addresses; use *host* itself (as sequence) if it already is an ip address. Thus, if only a specific interface on a host is trusted, identify it by its ip (and not the host name). iN(tisIp_thostt gethostbyaddr(R´R³((RR[ºs (RœRR‰RRutretcompileRµttwisted.internet.reactorR<RR;t ImportErrorR9tZConfig.components.loggerRRR4RR R RRRRRR*tmatchR[(RR<RRRR4R;RRµR9RR RR[RRuR·R*R‰((Rt?s0             ÿ 9