;ò í4fCc@s_dZdklZlZlZdkZdklZdkl Z l Z de fd„ƒYZ de fd„ƒYZ d e fd „ƒYZd e fd „ƒYZd efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd!efd"„ƒYZd#efd$„ƒYZd%efd&„ƒYZd'efd(„ƒYZd)efd*„ƒYZd+efd,„ƒYZd-fd.„ƒYZ d/e efd0„ƒYZ!d1e efd2„ƒYZ"d3e"fd4„ƒYZ#dS(5s$Revision: 1.8 $(sListTypes TupleTypes StringTypeN(sTag(smkDictslogs FormExceptioncBstZRS(N(s__name__s __module__(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys FormException"ss FieldMissingcBstZdd„ZRS(Ns is mandatorycCs&||_||_ti||ƒdS(N(sfieldsselfsmessages Exceptions__init__(sselfsfieldsmessage((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys__init__$s  (s__name__s __module__s__init__(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys FieldMissing#ssValidationErrorcBstZd„ZRS(NcCs&||_||_ti||ƒdS(N(sfieldsselfsmessages Exceptions__init__(sselfsfieldsmessage((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys__init__*s  (s__name__s __module__s__init__(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysValidationError)ssValidationFailurecBstZd„ZRS(NcCs||_ti|tƒdS(N(serrorssselfs Exceptions__init__smessage(sselfserrors((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys__init__0s (s__name__s __module__s__init__(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysValidationFailure/ssFormPartcBs/tZdZdZdZdZdZd„ZRS(Ns formStatesstartserrorsconfirmssubmitcCs&|iƒi|itiƒ}|SdS(N(shandlersscratchsgetsselfs FORMsTATEkEYsFormPartsSTARTsstate(sselfshandlersstate((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysgetStateDs(s__name__s __module__s FORMsTATEkEYsSTARTsINeRRORs INcONFIRMsINsUBMITsgetState(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysFormPart;s sFormcBsžtZd„Zd„Zd„Zd„Zd„Zdd„Zd„Zd „Z d „Z d „Z dd „Z d „Z d„Zd„Zd„Zd„ZRS(NcCsti|ƒdS(N(sTagsinitsself(sself((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysinitJscCs´||j o£|o t|dƒoˆy#|i|iƒ|iiƒ|(shiddenshtmlsitemssksv(sselfshiddenskshtmlsv((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys renderHiddenŠs  cCshSdS(N((sselfshandler((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getHidden‘scCsN|iidƒ}| o,|iƒiƒ}|iƒt |ƒ}n|SdS(Nsaction( sselfsattrssgetsactionshandlersreqsgetUrlsurlsclearsstr(sselfshandlersactionsurl((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getAction•s  cCsš|i|ƒ}|o|id|ƒ}n |iƒ}|i|ƒ}|iƒi dƒ|d<|i |ƒ||i <|i |ƒ}d|||fSdS(Nsactions
%s %s
(sselfs getActionshandlersactions buildAttrss formattrss getHiddenshiddensreqsgetInputsgetStates FORMsTATEkEYs renderHiddensfields(sselfshandlersfieldssactionshiddens formattrs((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys renderFormžs cCs|i||ƒSdS(N(sselfs renderFormshandlerscdata(sselfshandlerscdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys renderConfirmªscCs|iƒiddƒSdS(Nssubmit.xssubmit(shandlersreqs hasInputs(sselfshandler((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysonSubmit­scCs|iƒiddƒSdS(Ns confirm.xsconfirm(shandlersreqs hasInputs(sselfshandler((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys onConfirmed°scCs|iƒidƒdSdS(NsGOTO NEXT PAGE(shandlersreqslog(sselfshandlerscdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysgoNext³scCs#|iƒi|iƒiƒƒdS(N(shandlersreqslogs getInputs(sselfshandlerscdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pyssubmit·scCs(|i||ƒ|i||ƒdSdS(Nsform submitted(sselfssubmitshandlerscdatasgoNext(sselfshandlerscdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysdoSubmitºs(s__name__s __module__sinits validatorsvalidates preProcesss prepareDatas__call__s renderHiddens getHiddens getActions renderForms renderConfirmsonSubmits onConfirmedsgoNextssubmitsdoSubmit(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysFormIs           sFieldcBs’tZdZd„Zd„Zdd„Zd„Zd„Zd„Zd „Z d „Z dd „Z d „Z d „Z d„Zd„Zd„ZRS(NicCs|iƒdSdS(Nsname(sselfsgetAttrs(sself((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysgetNameÄscCs‹|iƒiddƒ}t|dƒo9|i|i|ƒƒ}|o|i||ƒ}qan|i ||ƒ}| o|Sn|SdS(Nsvaluessrecord( sselfsgetAttrssgets startvalueshasattrsfromDbsrecordshandlersnames getFormValuesvalue(sselfshandlersnamesvaluesrecords startvalue((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getStartValueÇsscCs|iƒi||ƒSdS(N(shandlersreqsgetInputsnamesdefault(sselfshandlersnamesdefault((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getFormValueÓscCs|SdS(N(svalue(sselfsvalue((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysfromDbÖscCsU|iƒ}|i|ƒtijo|i||ƒ}n|i ||ƒ}|SdS(N( sselfsgetNamesnamesgetStateshandlersFormsSTARTs getStartValuesvalues getFormValue(sselfshandlersvaluesname((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysgetValueÚs  cCsd|iƒ}|i||ƒ}|ip|iƒidƒo| ot |iƒƒ‚n|SdS(Nsrequired( sselfsgetNamesnames getFormValueshandlersvaluesREQUIREDsgetAttrssgets FieldMissing(sselfshandlersnamesvalue((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysisGivenãs  (cCs|i|ƒSdS(N(sselfsisGivenshandler(sselfshandler((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysvalidateëscCs|SdS(N(scdata(sselfshandlerscdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pyscDataîscCs |iƒidƒo2|i|ƒ}|i|||i||ƒƒSn|i |ƒt i jo2|i|ƒ}|i |||i||ƒƒSn|i |ƒt i jon|iƒi|dƒ}t|tƒo#|i|||i||ƒƒSq|i |||i||ƒƒSn|i |ƒt ijo;|iƒi|dƒ}|i|||i||ƒƒSn|i|ƒ}|i |||i||ƒƒSdS(Nsreadonlys(sselfsgetAttrssgetsgetValueshandlersvaluesrenderReadOnlyscDatascdatasgetStatesFormsSTARTsrenderEditablesINeRRORsscratchs isinstances FormExceptions renderInErrors INcONFIRM(sselfshandlerscdatasvalue((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys__call__ñs #####cKsti||�SdS(N(sTags buildAttrssselfskws(sselfshandlerskws((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys buildAttrs scCs3d|i||i|ƒ|ƒ|iƒ|fSdS(Ns&%s <- %s: %s (sselfsrenderEditableshandlersgetValuescdatasgetNamesvalue(sselfshandlersvaluescdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys renderInError scCsm|o;d|iƒd|i|d|ƒ||iƒdfSn(d|iƒd|i|d|ƒfSdS(Ns<%s %s>%sstagnamesvalues <%s %s />(scdatasselfsgetAttrss buildAttrsshandlersvalue(sselfshandlersvaluescdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderEditables;cCs$d||iƒ|i|ƒfSdS(Ns3%s(svaluesselfsgetNamesgetValueshandler(sselfshandlersvaluescdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnlyscCs…d}|iƒ}t|ƒtgƒjo6t|d„|ft|ƒ|ƒ}di |ƒSnd||iƒ|i |ƒfSdS(Ns-%scCs||||fS(N(shsvsn(snsvsh((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysss,s3%s( shtmlsselfsgetNamesnamestypesvaluessmapslensfieldssjoinsgetValueshandler(sselfshandlersvaluesscdatasnamesfieldsshtml((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnlys  %(s__name__s __module__sREQUIREDsgetNames getStartValues getFormValuesfromDbsgetValuesisGivensvalidatescDatas__call__s buildAttrss renderInErrorsrenderEditablesrenderReadOnly(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysFieldÁs           s DefaultFieldcBs#tZeZeZdZd„ZRS(NscCsªti|ƒ|io|iƒid|iƒn|iƒidƒ o[|i o9|ii t |i ƒ }|di ƒ|d|_n|i|iƒd(sselfsgetNamesgetValueshandler(sselfshandlersvaluescdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnlyEs(s__name__s __module__sTYPEsEXTsrenderReadOnly(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysHiddenBssMultiplecBs)tZdZdZdd„Zd„ZRS(NscheckedsvaluescCs|iƒi|ƒSdS(N(shandlersreqs getInputssname(sselfshandlersnamesdefault((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getFormValueOscKs´|i|�}|i|ƒ}t|ƒtgƒjo |g}n|iƒi dƒ}|o@||jot ||i cCs||||fS(N(shsvsn(snsvsh((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysss,( shtmlsselfsgetNamesnamestypesvaluessmapslensfieldssjoin(sselfshandlersvaluesscdatasnamesfieldsshtml((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnly{s  %(s__name__s __module__s getFormValuesrenderEditablesrenderReadOnly(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysOptionsss  sSubmitcBs&tZdZdZd„Zd„ZRS(NsSubmitssubmitcKsH|i|ƒtijod|d%s(sselfsgetLabelsvaluesgetNamesgetValueshandler(sselfshandlersvaluescdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnly®sc Csâ|i}d}xÈ|D]À}t|ƒttfjoPt|ƒ}|djo|\}}}q�|d|ddf\}}}n||df\}}}t |ƒt |ƒjo d}nd||||f}qW|SdS(Nsiiisselecteds#%s(sselfsOPTIONSsoptionss optionListsostypesListTypes TupleTypeslensolensvalueslabelschosensstrsselected( sselfsselectedsvalueschosenslabelsos optionListsolensoptions((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getOptionList±s   $ cCsŒ|iƒidƒ}|tjo |iSn|i|iƒ}t|i d„|ƒ}t |dƒdjott||ƒ}n|SdS(NsoptionscCs |i|ƒS(N(sxssplitsch(sxsch((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysÇsii( sselfsgetAttrssgetsoptionssNonesOPTIONSssplits FIRSTSplitsmaps SECONDSplitslen(sselfsoptions((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getOptionsÂs  ( s__name__s __module__sEXTsOPTIONSs FIRSTSplits SECONDSplitsinitsrenderEditablesgetLabelsrenderReadOnlys getOptionLists getOptions(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysSelect’s    sTextAreacBstZdZd„ZRS(NsTextAreacCs7|i|ƒ}|o |}nti|||ƒSdS(N(sselfsgetValueshandlersvaluescdatas DefaultFieldscData(sselfshandlerscdatasvalue((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pyscDataÐs (s__name__s __module__sEXTscData(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysTextAreaÍssFilecBs\tZdZdZdZdZdZdZd„Zdd „Z d „Z d „Z d „Z RS( NsFilesfiles
current choice: %s ssavedAsssaveds‹%(filename)scCsFti||||iƒ}ti||||iƒ}||fSdS(N( s DefaultFields getStartValuesselfshandlersnamesSAVEDsfilenamesSAVEDASstempname(sselfshandlersnamesfilenamestempname((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getStartValueÞsscCsa|iƒi|ƒ}|tjpt|ƒtdƒjo|Sn|iƒ|i |i fSdS(Ns( shandlersreqsgetFilesnamesfilesNonestypesdefaultskeepsfilenamestempname(sselfshandlersnamesdefaultsfile((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys getFormValueãs & cCsŒd}d}|tjpt|ƒtdƒj o;|\}}|iƒid|i ƒ|i ||ƒ}nt i ||||ƒ|SdS(Nss currentlabel(sfilenamescurrentsfilesNonestypestempnamesselfsgetAttrssgets CURRENTLABELsreadOnlys DefaultFieldsrenderEditableshandlerscdata(sselfshandlersfilescdatasfilenamescurrentstempname((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderEditableís ' /cCsW|tjpt|ƒtdƒj o|\}}n d}d}|i||ƒSdS(Ns(sfilesNonestypesfilenamestempnamesselfsreadOnly(sselfshandlersfilescdatasfilenamestempname((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnly÷s 'c CsJ|iƒ}td||id||id|d|ƒ}|i |SdS(NssavedssavedAssfilenamestempname( sselfsgetNamesnamesmkDictsSAVEDsSAVEDASsfilenamestempnamesattrss READoNLYhTML(sselfsfilenamestempnamesnamesattrs((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysreadOnlyÿs /( s__name__s __module__sEXTsTYPEs CURRENTLABELsSAVEDASsSAVEDs READoNLYhTMLs getStartValues getFormValuesrenderEditablesrenderReadOnlysreadOnly(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysFileÖs  sPasswordEncodercBstZd„Zd„ZRS(NcCs.|d djod|i|ƒSn|SdS(Nisx:(sxsselfscrypt(sselfsx((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysencodescCsti|ƒ}|iƒSdS(N(smd5snewsxseggs hexdigest(sselfsxsegg((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pyscrypt s(s__name__s __module__sencodescrypt(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysPasswordEncoders s PasswordGroupcBstZd„ZRS(NcCs'|i|ƒ}d|iƒ|fSdS(Ns*(sselfsencodesvaluesgetName(sselfshandlersvaluescdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnlys(s__name__s __module__srenderReadOnly(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys PasswordGroupss PasswordInputcBs,tZdZdZdZd„Zd„ZRS(NspasswordiicCsd|iƒ|fSdS(Ns.****(sselfsgetNamesvalue(sselfshandlersvaluescdata((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysrenderReadOnlyscCszti||ƒ}t|iƒidt|i ƒƒƒ}t |ƒ|jot |i ƒd|ƒ‚n|i|ƒSdS(Nssizes must be %d characters or longer(sInputsvalidatesselfshandlersvaluesintsgetAttrssgetsstrsSIZEssizeslensValidationErrorsgetNamesencode(sselfshandlersvaluessize((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysvalidates '(s__name__s __module__sTYPEsSIZEsREQUIREDsrenderReadOnlysvalidate(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys PasswordInputs  sPasswordConfirmInputcBstZd„ZRS(NcCsg|iti||ƒƒ}|i|iƒidƒƒ}||jot |i ƒdƒ‚n|SdS(Nspasswords8must be the same as what you entered for password( sselfsencodesInputsvalidateshandlersvaluesreqsgetInputspasswdsValidationErrorsgetName(sselfshandlerspasswdsvalue((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysvalidate&s  (s__name__s __module__svalidate(((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pysPasswordConfirmInput%s($s __version__stypessListTypes TupleTypes StringTypesmd5sparsersTagsutilsmkDictslogs Exceptions FormExceptions FieldMissingsValidationErrorsValidationFailuresFormPartsFormsFields DefaultFieldsInputsGroupsReadOnlysHiddensMultiplesCheckBoxsRadiosOptionssSubmitsSelectsTextAreasFilesPasswordEncoders PasswordGroups PasswordInputsPasswordConfirmInput( sCheckBoxsGroups FieldMissingsSubmitsFields DefaultFieldsInputsHiddens StringTypesMultipleslogsForms PasswordGroupsValidationFailuresmkDicts __version__s PasswordInputsValidationErrorsFormPartsPasswordEncodersListTypes TupleTypesOptionssmd5sTextAreasReadOnlysTagsRadiosFilesPasswordConfirmInputs FormExceptionsSelect((s6/home/groups/p/ps/pso/htdocs/tutorial/Edit/pso/form.pys?s8   xb   ; /