m DMc@sdZdkZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk Z dk Z dk Z dkZdkZdkZdklZdklZdklZlZlZeed o ee_neiej oee_neiideie_ ei e_!ei!a"ee_#e$e_%edk&Z&dk'Z&edZ(ei)i*e(oe&i+i,edn e&i-e&i.dZ/d k0l1Z1d k2l3Z3l4Z4d k5l6Z6l7Z7l8Z8d k9l:Z:l;Z;l<Z<l=Z=d kl>Z>dk?l?Z?dk@lAZAdklZdkBlCZCdkDlEZEdkFlGZHdkIZIdkJZJddddgZKdaLeiMdZNeOeddedZPePiQZRePiSy dkTZTWn#eiU oe/iVdnnXeJiWdZXddd ZYd!ZZe[d"Z\d#Z]d$Z^d%Z_d&Z`d'Zae`d(d)d*Zbdecfd+YZddS(,s This file is part of the web2py Web Framework Copyrighted by Massimo Di Pierro License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) Contains: - wsgibase: the gluon wsgi application N(sabspath(sglobal_settings(sadd_path_firstscreate_missing_foldersscreate_missing_app_folderstmkdirt web2py_paths logging.conftweb2py(sRestrictedError(sHTTPsredirect(sRequestsResponsesSession(sbuild_environments run_models_insrun_controller_ins run_view_in(s copystream(s contenttype(s BaseAdapter(sCRYPT(sCache(sURLtwsgibaset save_passwordt appfactoryt HttpServeris[\w\-:]+(\.[\w\-]+)*\.?tVERSIONtgluontrsunable to import RocketcCsdti|idd}|o|iSnti|idd}|o|iSndS(s guess the client address from the environment variables first tries 'http_x_forwarded_for', secondly 'remote_addr' if all fails assume '127.0.0.1' (running locally) thttp_x_forwarded_fortt remote_addrs 127.0.0.1N(t regex_clienttsearchtenvtgettgtgroup(RR((t4/home/camdpams_www/Products_Activation/gluon/main.pyt get_clientssi ic s|iiptiSn|ii}t|iit i }d|i jot ||||Snd|i d}t|}|i|ddd|i|dddxdjo|jo*|i}|ii|dn'|i|}|ii|d|t|}|jo| }}n|8|djoPn|i|||joPqqW|id|i|dd|i|dd|S( s copies request.env.wsgi_input into request.body and stores progress upload status in cache.ram X-Progress-ID:length and X-Progress-ID:uploaded s X-Progress-IDsX-Progress-ID:s:lengthcsS(N(tsize((R(Rtsis :uploadedcCsdS(Ni((((RRsN(trequestRtcontent_lengtht cStringIOtStringIOt wsgi_inputtsourcetintRttempfilet TemporaryFiletdesttvarst copystreamt chunk_sizet cache_keytCachetcachetramtreadtdatat incrementtlentlengthtwritetseektNone( RR#R&R RR,R$R)R((RRtcopystream_progresssB              cCst|||}d|i|i|if|_t |t i ||_ t |i|i|}t|toK||_x|D]}|||i |R5RB((Rtserve_controllers$    %cs8t|iddd_t|_dS(s in controller you can use:: - request.wsgi.environ - request.wsgi.start_response to call third party WSGI applications t iicsidt||S(Ntescape(R3R-tFalsetargstkargs(RPRQ(R3(RRsN(tstrRJtsplitR3R@RK(RJRKtexc_infoR3((R3Rtstart_response_auxscsd}|S(s In you controller use:: @request.wsgi.middleware(middleware1, middleware2, ...) to decorate actions with WSGI middleware. actions must return strings. uses a simulated environment so it may have weird behavior in some cases csEd}xD]}||}qWd}||dS(NcsA}|iiit|to|Sn|gS(N( tfR)tstart_responseR3RJRKtitemsR?tlist(tenvironRWR)(RVR3(Rtapps  cs|iiiiS(N(R[RtwsgiRZRW(R[(R(RtcallerscCs ||S(N(R]R[(R]R[((RRs(R[tmiddleware_appstitemR](RVR[R]R_(R^RR3(RVRt middlewares  N(R`(RR3R^R`((RR3R^Rtmiddleware_auxs cCs*ti|}|i|dj o }qIXn|i@tAdiBid/static/ 2. for dynamic pages: - /[/[/[/]]][.] - (sub may go several levels deep, currently 3 levels are supported: sub1/sub2/sub3) The naming conventions are: - application, controller, function and extension may only contain [a-zA-Z0-9_] - file and sub may also contain '-', '=', '.' and '/' t PATH_INFOt REQUEST_URIt?iit QUERY_STRINGR Rmi t attachmentsContent-DispositionRt applicationstxmlhttprequesttwelcomeR t applicationR6R7RPisinvalid requestt web2py_errorsinvalid applicationR8t200cCst||||S(N(RURJRKt exec_infoR3(RJRKRR3((RRscst|S(N(RaRR3Ri(Ri(RR3(RRst.s Content-Types>no-store, no-cache, must-revalidate, post-check=0, pre-check=0s Cache-Controls%a, %d %b %Y %H:%M:%S GMTtExpiressno-cachetPragmatcommitsweb2py-component-flashs sweb2py-component-commandtsecurei s Set-Cookietunknowntrollbackittickets ticket %st Frameworkt unrecoverableNt session_filetsoft(jtRequestRtResponseR3tSessionR4tglobal_settingstapplications_parentRRtweb2py_versiontupdateROt static_fileRZRR/RSRXR+trewriteturl_inRKtstreamRtclienttabspathRtostseptfolderRRthttp_x_requested_withtlowertajaxthttp_web2py_component_elementtcidt compute_uuidtuuidtpathtexiststthreadtroutestdefault_applicationtredirecttUrlt error_handlerRIt error_messageRPt raw_extensionturltcreate_missing_app_foldersRRcR\RWR`t http_cookietcookiestloadtCookiet CookieErrortetconnectt contenttypeR8ttimetstrftimetgmtimeRLt http_responsettot responderRDtcloset_try_store_in_dbt_custom_committ BaseAdaptertclose_all_instancest_try_store_on_disktflashtreplacetjst_forgettsession_id_namet_securetTrueR~tvaluestcookieRtRestrictedErrortlogt_custom_rollbackterror_message_ticketR@tlocalsthasattrRt_unlockttry_redirect_on_errortweb2py_crontypetnewcrontsoftcrontstart( RZRR4RRRRR3RXRR~R((R3RRR:s     ' !)           &*  ?      ! cCs<td|}|djostiti}dig}t dD]}|t i |qD~}t|d}dGHd|GHdGHng|d jo%tii|od Sqd}n5|id o|d d !}nt|d}t|d}|o|id|n|id|id S(sM used by main() to save the password in the parameters_port.py file. sparameters_%i.pysR iis9******************* IMPORTANT!!! ************************syour admin password is "%s"s9*********************************************************s Ns        )  _ N( RRRRtunlinkRt allocate_lockR R(RRRRR ((RRRR RR_s  7cBs\tZdZdddddeeeeeeddeeedZd Zed ZRS( s( the web2py web server (Rocket) s 127.0.0.1i@R shttpserver.pidshttpserver.logii cCs3|oXdk}t||io2x5|D]#}t||ip dq*q*Wq_dn|oftii|}|a |t _ ti |g}|tddfD]}|t|q~nt||||_| pti} ntid| t_||g}| p| otidnti!pti"dnitii#|pti"dnEtii#|pti"d n!|i$||gtid hd t%t&||<}ti*|p t+|d d d|d| d| dt.| dt.| dt1|_2dS(s( starts the web server. NsUWrong format for rocket interfaces parameter - see http://packages.python.org/rocket/s site-packagesR sstarting web server...s SSL is offs+Python "ssl" module unavailable. SSL is OFFs*unable to open SSL certificate. SSL is OFFs*unable to open SSL private key. SSL is OFFs SSL is ONtwsgi_apptmethodR\tapp_infot min_threadst max_threadst queue_sizettimeoutthandle_signals(3t interfacesttypesR?tListTypeRt TupleTypeRRtnormpathRRRtchdirR~Rtptadd_path_firstRRRt pid_filenametselft server_nametsockett gethostnameR tinfotrockett SERVER_NAMEtipt sock_listtssl_certificatetssl_private_keytssltwarningRtextendRRt log_filenametprofiler_filenameR tRocketttupleR!R"Rtrequest_queue_sizeR$ROtserver(R/R6RRR.R=R>R8R9R!R"R0RAR$tshutdown_timeoutRR&R7R R'RR~R,((Rt__init__sX    8           cCsy6titi|dtiti|dWnnXt|id}|itt i |i |i i dS(s& start the web server cCs |iS(N(Rtstop(RitbR((RRscCs |iS(N(RRE(RiRFR((RRsRN(tsignaltSIGTERMR/tSIGINTRR.RhR-RRRtgetpidRRBR(R/Rh((RRs cCs<ti|ii|yti|iWnnXdS(s. stop cron and the web server N( RtstopcronR/RBREt stoploggingRRR.(R/RL((RRE s (t__name__t __module__t__doc__R/RDRRORE(((RRs 9M (eRORGRkRRRtreR;RvRRRRGR1RRRt fileutilsRtsettingsRtadminR-tcreate_missing_foldersRRRt db_sessionstsetRZRtgetcwdt gluon_parentRRt app_foldersROt debuggingtloggingtlogging.configtlogpathRRtconfigt fileConfigt basicConfigt getLoggerR t restrictedRthttpRIRRFRRRt compileappR2R:R=RCR"RtdalRt validatorsRR&R%thtmltURLRRRt__all__R1tcompileR RRwR(RRR4tweb2py_runtime_gaeR RRR0RLR/RURaRcRRRRtobjectR(:RRRIR4R2RRRRRGRaRRRRRRiRRRRR]RPRRCR RURRkR%RRTRwRR RR:RRRvRRR[R;R"R-R0RLR1RRGR=RRRRRcR((RR s                                           ( .    7  "K