;ò { ò@c@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__(((s../pso/form.pys FormException"ss FieldMissingcBstZdd„ZRS(Ns is mandatorycCs&||_||_ti||ƒdS(N(sfieldsselfsmessages Exceptions__init__(sselfsfieldsmessage((s../pso/form.pys__init__$s  (s__name__s __module__s__init__(((s../pso/form.pys FieldMissing#ssValidationErrorcBstZd„ZRS(NcCs&||_||_ti||ƒdS(N(sfieldsselfsmessages Exceptions__init__(sselfsfieldsmessage((s../pso/form.pys__init__*s  (s__name__s __module__s__init__(((s../pso/form.pysValidationError)ssValidationFailurecBstZd„ZRS(NcCs||_ti|tƒdS(N(serrorssselfs Exceptions__init__smessage(sselfserrors((s../pso/form.pys__init__0s (s__name__s __module__s__init__(((s../pso/form.pysValidationFailure/ssFormPartcBs/tZdZdZdZdZdZd„ZRS(Ns formStatesstartserrorsconfirmssubmitcCs&|iƒi|itiƒ}|SdS(N(shandlersscratchsgetsselfs FORMsTATEkEYsFormPartsSTARTsstate(sselfshandlersstate((s../pso/form.pysgetStateDs(s__name__s __module__s FORMsTATEkEYsSTARTsINeRRORs INcONFIRMsINsUBMITsgetState(((s../pso/form.pysFormPart;s sFormcBs•tZd„Zd„Zd„Zd„Zdd„Zd„Zd„Zd „Z d „Z dd „Z d „Z d „Z d„Zd„Zd„ZRS(NcCsti|ƒdS(N(sTagsinitsself(sself((s../pso/form.pysinitJscCs´||j o£|o t|dƒoˆy#|i|iƒ|iiƒ|(shiddenshtmlsitemssksv(sselfshiddenskshtmlsv((s../pso/form.pys renderHiddenƒs  cCshSdS(N((sselfshandler((s../pso/form.pys getHiddenŠscCsN|iidƒ}| o,|iƒiƒ}|iƒt |ƒ}n|SdS(Nsaction( sselfsattrssgetsactionshandlersreqsgetUrlsurlsclearsstr(sselfshandlersactionsurl((s../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((s../pso/form.pys renderForm—s cCs|i||ƒSdS(N(sselfs renderFormshandlerscdata(sselfshandlerscdata((s../pso/form.pys renderConfirm£scCs|iƒiddƒSdS(Nssubmit.xssubmit(shandlersreqs hasInputs(sselfshandler((s../pso/form.pysonSubmit¦scCs|iƒiddƒSdS(Ns confirm.xsconfirm(shandlersreqs hasInputs(sselfshandler((s../pso/form.pys onConfirmed©scCs|iƒidƒdSdS(NsGOTO NEXT PAGE(shandlersreqslog(sselfshandlerscdata((s../pso/form.pysgoNext¬scCs#|iƒi|iƒiƒƒdS(N(shandlersreqslogs getInputs(sselfshandlerscdata((s../pso/form.pyssubmit°scCs(|i||ƒ|i||ƒdSdS(Nsform submitted(sselfssubmitshandlerscdatasgoNext(sselfshandlerscdata((s../pso/form.pysdoSubmit³s(s__name__s __module__sinits validatorsvalidates preProcesss__call__s renderHiddens getHiddens getActions renderForms renderConfirmsonSubmits onConfirmedsgoNextssubmitsdoSubmit(((s../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((s../pso/form.pysgetName½scCs‹|iƒiddƒ}t|dƒo9|i|i|ƒƒ}|o|i||ƒ}qan|i ||ƒ}| o|Sn|SdS(Nsvaluessrecord( sselfsgetAttrssgets startvalueshasattrsfromDbsrecordshandlersnames getFormValuesvalue(sselfshandlersnamesvaluesrecords startvalue((s../pso/form.pys getStartValueÀsscCs|iƒi||ƒSdS(N(shandlersreqsgetInputsnamesdefault(sselfshandlersnamesdefault((s../pso/form.pys getFormValueÌscCs|SdS(N(svalue(sselfsvalue((s../pso/form.pysfromDbÏscCsU|iƒ}|i|ƒtijo|i||ƒ}n|i ||ƒ}|SdS(N( sselfsgetNamesnamesgetStateshandlersFormsSTARTs getStartValuesvalues getFormValue(sselfshandlersvaluesname((s../pso/form.pysgetValueÓs  cCsd|iƒ}|i||ƒ}|ip|iƒidƒo| ot |iƒƒ‚n|SdS(Nsrequired( sselfsgetNamesnames getFormValueshandlersvaluesREQUIREDsgetAttrssgets FieldMissing(sselfshandlersnamesvalue((s../pso/form.pysisGivenÜs  (cCs|i|ƒSdS(N(sselfsisGivenshandler(sselfshandler((s../pso/form.pysvalidateäscCs|SdS(N(scdata(sselfshandlerscdata((s../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((s../pso/form.pys__call__ês #####cKsti||�SdS(N(sTags buildAttrssselfskws(sselfshandlerskws((s../pso/form.pys buildAttrsscCs3d|i||i|ƒ|ƒ|iƒ|fSdS(Ns&%s <- %s: %s (sselfsrenderEditableshandlersgetValuescdatasgetNamesvalue(sselfshandlersvaluescdata((s../pso/form.pys renderInErrorscCsm|o;d|iƒd|i|d|ƒ||iƒdfSn(d|iƒd|i|d|ƒfSdS(Ns<%s %s>%sstagnamesvalues <%s %s />(scdatasselfsgetAttrss buildAttrsshandlersvalue(sselfshandlersvaluescdata((s../pso/form.pysrenderEditable s;cCs$d||iƒ|i|ƒfSdS(Ns3%s(svaluesselfsgetNamesgetValueshandler(sselfshandlersvaluescdata((s../pso/form.pysrenderReadOnlyscCs…d}|iƒ}t|ƒtgƒjo6t|d„|ft|ƒ|ƒ}di |ƒSnd||iƒ|i |ƒfSdS(Ns-%scCs||||fS(N(shsvsn(snsvsh((s../pso/form.pysss,s3%s( shtmlsselfsgetNamesnamestypesvaluessmapslensfieldssjoinsgetValueshandler(sselfshandlersvaluesscdatasnamesfieldsshtml((s../pso/form.pysrenderReadOnlys  %(s__name__s __module__sREQUIREDsgetNames getStartValues getFormValuesfromDbsgetValuesisGivensvalidatescDatas__call__s buildAttrss renderInErrorsrenderEditablesrenderReadOnly(((s../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((s../pso/form.pysrenderReadOnly>s(s__name__s __module__sTYPEsEXTsrenderReadOnly(((s../pso/form.pysHidden;ssMultiplecBs)tZdZdZdd„Zd„ZRS(NscheckedsvaluescCs|iƒi|ƒSdS(N(shandlersreqs getInputssname(sselfshandlersnamesdefault((s../pso/form.pys getFormValueHscKs´|i|�}|i|ƒ}t|ƒtgƒjo |g}n|iƒi dƒ}|o@||jot ||i cCs||||fS(N(shsvsn(snsvsh((s../pso/form.pysxss,( shtmlsselfsgetNamesnamestypesvaluessmapslensfieldssjoin(sselfshandlersvaluesscdatasnamesfieldsshtml((s../pso/form.pysrenderReadOnlyts  %(s__name__s __module__s getFormValuesrenderEditablesrenderReadOnly(((s../pso/form.pysOptionsls  sSubmitcBs&tZdZdZd„Zd„ZRS(NsSubmitssubmitcKsH|i|ƒtijod|d%s(sselfsgetLabelsvaluesgetNamesgetValueshandler(sselfshandlersvaluescdata((s../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((s../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((s../pso/form.pysÀsii( sselfsgetAttrssgetsoptionssNonesOPTIONSssplits FIRSTSplitsmaps SECONDSplitslen(sselfsoptions((s../pso/form.pys getOptions»s  ( s__name__s __module__sEXTsOPTIONSs FIRSTSplits SECONDSplitsinitsrenderEditablesgetLabelsrenderReadOnlys getOptionLists getOptions(((s../pso/form.pysSelect‹s    sTextAreacBstZdZd„ZRS(NsTextAreacCs7|i|ƒ}|o |}nti|||ƒSdS(N(sselfsgetValueshandlersvaluescdatas DefaultFieldscData(sselfshandlerscdatasvalue((s../pso/form.pyscDataÉs (s__name__s __module__sEXTscData(((s../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((s../pso/form.pys getStartValue×sscCsa|iƒi|ƒ}|tjpt|ƒtdƒjo|Sn|iƒ|i |i fSdS(Ns( shandlersreqsgetFilesnamesfilesNonestypesdefaultskeepsfilenamestempname(sselfshandlersnamesdefaultsfile((s../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((s../pso/form.pysrenderEditableæs ' /cCsW|tjpt|ƒtdƒj o|\}}n d}d}|i||ƒSdS(Ns(sfilesNonestypesfilenamestempnamesselfsreadOnly(sselfshandlersfilescdatasfilenamestempname((s../pso/form.pysrenderReadOnlyðs 'c CsJ|iƒ}td||id||id|d|ƒ}|i |SdS(NssavedssavedAssfilenamestempname( sselfsgetNamesnamesmkDictsSAVEDsSAVEDASsfilenamestempnamesattrss READoNLYhTML(sselfsfilenamestempnamesnamesattrs((s../pso/form.pysreadOnlyøs /( s__name__s __module__sEXTsTYPEs CURRENTLABELsSAVEDASsSAVEDs READoNLYhTMLs getStartValues getFormValuesrenderEditablesrenderReadOnlysreadOnly(((s../pso/form.pysFileÏs  sPasswordEncodercBstZd„Zd„ZRS(NcCs.|d djod|i|ƒSn|SdS(Nisx:(sxsselfscrypt(sselfsx((s../pso/form.pysencodeÿscCsti|ƒ}|iƒSdS(N(smd5snewsxseggs hexdigest(sselfsxsegg((s../pso/form.pyscrypts(s__name__s __module__sencodescrypt(((s../pso/form.pysPasswordEncoderþs s PasswordGroupcBstZd„ZRS(NcCs'|i|ƒ}d|iƒ|fSdS(Ns*(sselfsencodesvaluesgetName(sselfshandlersvaluescdata((s../pso/form.pysrenderReadOnly s(s__name__s __module__srenderReadOnly(((s../pso/form.pys PasswordGroupss PasswordInputcBs,tZdZdZdZd„Zd„ZRS(NspasswordiicCsd|iƒ|fSdS(Ns.****(sselfsgetNamesvalue(sselfshandlersvaluescdata((s../pso/form.pysrenderReadOnlyscCszti||ƒ}t|iƒidt|i ƒƒƒ}t |ƒ|jot |i ƒd|ƒ‚n|i|ƒSdS(Nssizes must be %d characters or longer(sInputsvalidatesselfshandlersvaluesintsgetAttrssgetsstrsSIZEssizeslensValidationErrorsgetNamesencode(sselfshandlersvaluessize((s../pso/form.pysvalidates '(s__name__s __module__sTYPEsSIZEsREQUIREDsrenderReadOnlysvalidate(((s../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((s../pso/form.pysvalidates  (s__name__s __module__svalidate(((s../pso/form.pysPasswordConfirmInputs($s __version__stypessListTypes TupleTypes StringTypesmd5sparsersTagsutilsmkDictslogs Exceptions FormExceptions FieldMissingsValidationErrorsValidationFailuresFormPartsFormsFields DefaultFieldsInputsGroupsReadOnlysHiddensMultiplesCheckBoxsRadiosOptionssSubmitsSelectsTextAreasFilesPasswordEncoders PasswordGroups PasswordInputsPasswordConfirmInput( sCheckBoxsGroups FieldMissingsSubmitsFields DefaultFieldsInputsHiddens StringTypesMultipleslogsForms PasswordGroupsValidationFailuresmkDicts __version__s PasswordInputsValidationErrorsFormPartsPasswordEncodersListTypes TupleTypesOptionssmd5sTextAreasReadOnlysTagsRadiosFilesPasswordConfirmInputs FormExceptionsSelect((s../pso/form.pys?s8   qb   ; /