mò DµMc@s{dZdkZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk l Z dk lZlZlZdklZdklZlZlZdklZdklZeidƒZd eƒeƒeƒd „Zeddd hd „Z d „Z!eeded „Z"d„Z#d„Z$e%ed„Z&d„Z'dd„Z(e)djo e(ƒndS(sá This file is part of the web2py Web Framework Developed by Massimo Di Pierro , limodou and srackham . License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) N(s web2py_uuid(sbuild_environmentsread_pycs run_models_in(sRestrictedError(sRequestsResponsesSession(sStorage(s w2p_unpacktweb2pytcBsÄ|idjoQeid|ƒ}|o+|idƒ}e i i d|ƒ|_qad|_ne |||ƒ}|o@|d}e i i|ƒoe|ƒ|Uqºe||ƒne|ƒS(sÄ .. function:: gluon.shell.exec_environment([pyfile=''[, request=Request() [, response=Response[, session=Session()]]]]) Environment builder and module loader. Builds a web2py environment and optionally executes a Python file into the environment. A Storage dictionary containing the resulting environment is returned. The working directory must be web2py root -- this is the web2py default. s%(|.*/)applications/(?P[^/]+)tappnamet applicationsRtcN(trequesttfoldertNonetretmatchtpyfiletmotgroupRtostpathtjointbuild_environmenttresponsetsessiontenvtpycfiletisfiletread_pyctexecfiletStorage(R RRRRR RR((t5/home/camdpams_www/Products_Activation/gluon/shell.pytexec_environment!s  cCsstƒ} tƒ}tƒ}|| _|pt i i d|ƒ| _ n || _ |pd| _|pd| _d| i| if|_d|||f| i_d| i_d| i_tii| i_x$|iƒD]\} } | | | ssha512:twRR7s.pytcompiledscontrollers_%s_%s.pycs print %s()Ntlocals_s'import bpython error; trying ipython...t __builtins__targvtuser_nss.import IPython error; use default python shells tab:completetlocal(;tparse_path_infoRR$RR(terrmsgtdieR RRtadirtexistst raw_inputtlowertmkdirt w2p_unpackt subfoldertsubpathtdbtopentfptreadtdatatclosetreplacet web2py_uuidR=RR7Rt_envtcfileRRRt startfileRER9R:R>tplaintbpythontembedtloggertwarningtIPythontShelltIPShelltshelltmainlooptreadlinet rlcompletert ImportErrort set_completert Completertcompletetparse_and_bindtcodetinteract(RRrR7RqRsRpRwRoRfRiR_RzRgReR|RkR}R$RR:R(R]((RtrunŽsŠ  #  +    %        cCsMtid|ƒ}|o,|idƒ|idƒ|idƒfSndSdS(sÚ Parse path info formatted like a/c/f where c and f are optional and a leading / accepted. Return tuple (a, c, f). If invalid path_info a is set to None. If c or f are omitted they are set to None. s*^/?(?P\w+)(/(?P\w+)(/(?P\w+))?)?$R$RR(N(NNN(RR R+R R R(R+R ((RR\ïs   ,cCsti|IJtidƒdS(Ni(R;R<tmsgR?(R†((RR^ÿs c sùdk‰tii|ƒoQtid|ƒ}|ptd|ƒn|i dƒ‰d‰‰|g}nÚt|ƒ\‰‰‰d|}ˆpt|ƒntiidˆdƒ}tii|ƒpt|ƒnˆoGtii|ˆdƒ}tii|ƒpt|ƒn|g}ntitii|d ƒƒ}x¬|D]¤‰tˆˆƒ}|iƒ}tˆ|ƒ‡‡‡‡‡‡‡‡d †‰xR|iƒD]D\} } | |jo+ˆdjp ˆ| joˆ| | ƒq©q©WqMWdS( s° Run doctests in web2py environment. testpath is formatted like: a tests all controllers in application a a/c tests controller c in application a a/c/f test function f in controller c, application a Where a, c and f are application, controller and function names respectively. If the testpath is a file name the file is tested. If a controller is specified models are executed by default. Ns(|.*/)applications/(?P[^/]+)s-test file is not in application directory: %sR$sinvalid test path: %sRRJs.pys*.pycsùt|ƒtititititifjoÄtˆdˆdˆdˆƒ}tˆ|ƒˆi|d|ddtiiˆƒ|fdˆƒt|ƒtitifjoAx>t|ƒD],}td||f|ƒ}ˆ||ƒq½Wqõnd S( s-doctest obj and enclosed methods and classes.RR(R7tglobstnames%s: %stverboses%s.%sN(ttypetobjttypest FunctionTypetTypeTypet ClassTypet MethodTypetUnboundMethodTypeRR$RR(R7R‡Rttestfiletdoctesttrun_docstring_examplesR RtbasenameRˆR‰R&t attr_nametevaltotdoctest_object(RˆR‹R‡R–R˜(R$RR(R™R’R‰R7R“(RR™.s1   (!R“R RRttestpathRR R R^R R$RRR(tfilesR\R]RtcdirtisdirRptglobR’RR7R‡tkeystignoresRR™R2RˆR‹(RšR7R‰RpR R‡R]R›RœR$RR‹RˆR(R R™R“R’((R7R‰R$RR(R™R“R’Rttests@        ! 'cCs d}|S(Ns %prog [options] pythonfile (tusage(R¢((Rt get_usageIsc Cs®|djo ti}ntidtƒƒ}|idddddddd d ƒd }|d 7}|d 7}|idddddt ddd|ƒ|idddddt ddddƒ|idddddt dddddƒ|idddddd dd!dd"d#ƒ|i |d$ƒ\}}t tiƒd$jo|iƒtid%ƒnt |ƒd%jo|d%}nd!}t|i|id&|d|iƒdS('NR¢s-Ss--shelltdestRztmetavartAPPNAMEthelps9run web2py in interactive shell or IPython(if installed) swith specified appnames>run web2py in interactive shell or bpython (if installed) withs> specified appname (if app does not exist it will be created).s Use combined with --shells-Bs --bpythontactiont store_trueRRss-Ps--plainRrs?only use plain python shell, should be used with --shell options-Ms--import_modelsR7s+auto import model files, default is False, s# should be used with --shell options-Rs--runR…t PYTHON_FILERs'run PYTHON_FILE in web2py environment, s"should be used with --shell optioniiRq(RYRR;toptparset OptionParserR£tparsert add_optionR†tFalset parse_argstoptionstargstlent print_helpR?RqR…RzRrRs(RYR²RqR­R†R±((Rtexecute_from_command_linePsP           t__main__(*t__doc__R R;RƒtloggingRŒRR«RžR5R.tutilsRnt compileappRRR8t restrictedR9tglobalsR!R"R#tstorageRRRdt getLoggerRuRR¯RRRER…R\R^RR¡R£Rµt__name__(R9RƒRRRR£RdRnR5RERµRR\RR¡RuR"R…RR«RžR!R;RŒR¸R.R^R#R8R ((Rt? s8              %? a  E  <