m /Ec@sdZddd!ZdkZdkZdkZdkZdkZdkZdk Z dk Z dk Z dk Z dkl Z lZdklZlZdklZlZdklZdkZdkZdkZdkZd klZlZlZlZlZdkZdkZdk Z dk!Z!d k"l#Z#d k$l$Z$d k%l&Z&l'Z'd k(l)Z)e i*Z+dk,Z,dk-Zdk.l/Z/l0Z0dk1l1Z1dk2l3Z3dkl4Z4dkl5Z5dkl6Z6dk7l8Z8dk7l9Z9dk7l:Z:dk;l<Z<dk=l>Z>dk?l@Z@dkAlBZBdkClDZEdeBfdYZFdeiGfdYZHd e<e,iIeHfd!YZJd"eiKe iLeiMeiNiOeiPiQe>fd#YZRe4eReSgZTd$e,iIfd%YZUd&fd'YZVdS((sGeneric Database adapters$Revision: 1.116 $i iN(s decodestringsparse(scustom_default_reportsdefault_input_form(sDTMLFiles MessageDialog(sStringIO(satoisfindsjoinssplitsrstrip(s html_quote(stime(scompresss decompress(sDateTime(sdumpssloads(sResults(sgetBrain(sInitializeClass(sClassSecurityInfo(sgetSecurityManager(schange_database_methods(suse_database_methods(sview_management_screens(sRestrictedDTML(sResource(sResourceLockedError(s BadRequest(sOOBuckett DatabaseErrorcBstZdZRS(sB base class for external relational data base connection problems (t__name__t __module__t__doc__(((t0/data/zmath/zope/lib/python/Shared/DC/ZRDB/DA.pyR2s tnvSQLcBshtZhZx*eiiiD]\ZZeeeZ8eie%d?d@Z9RS(KsDatabase Adaptert AnonymoustManageriiidttlabeltEdittactiont manage_mainthelpt ZSQLMethodssZ-SQL-Method_Edit.stxtTesttmanage_testFormsZ-SQL-Method_Test.stxtAdvancedtmanage_advancedFormsZ-SQL-Method_Advanced.stxcCs)t||_|i||||dS(N(tstrtidtselft manage_editttitlet connection_idt argumentsttemplate(R$R#R&R'R(R)((Rt__init__lss dtml/advancedttest_urlcCsdS(s0Method for testing server connection informationtPINGN((R$((Rt test_url_tstBiggeritSmalleritNarrowertWidertTallertShorterc  Cs@|i|\}} ttdt||} t|} | i do4tt dtdt| d | d} n ttdt| | } tddi} |d i} | d | d d d | | d| d d d | |iihd| <d | <|i||d|d|d|d|S(Nit%idiii#tGMTimtRESPONSEt dtpref_rowstpatht/texpirest dtpref_colsR&t arguments_srcR'tsrc(R$t _size_changestSUBMITtdrtdcR"tmaxtintR7trowsR;tcolstendswithtmintDateTimetrfc822tetREQUESTt setCookietothertupdateRR&R(R'R)(R$R&R'R(R)R?R;R7RKRLRDRJRARER@((Rt_ers 4 "R%tChanges100%t20c Cs%|ii|o&|i||||||||Sn|i o t dnt||_t||_t|}||_t||_t|}||_|i||_} | ihtf|_|o>|djo|i|Snd} |i||d| SndS(sChange database method properties The 'connection_id' argument is the id of a database connection that resides in the current folder or in a folder above the current folder. The database should understand SQL. The 'arguments' argument is a string containing an arguments specification, as would be given in the SQL method cration form. The 'template' argument is a string containing the source for the SQL Template. sSQL Method is locked via WebDAVsChange and TestsZSQL Method content changedtmanage_tabs_messageRN(R$R>thas_keyR?ROR&R'R(R)R;R7RKt wl_isLockedtResourceLockedErrorR"R<tparset_argR=ttemplate_classtttcooktBuckett_v_cacheRtmessageR( R$R&R'R(R)R?R;R7RKR]RY((RR%s,        tmanage_advancedc Cst|tdj ot|}nt|tdj ot|}nt|tdj ot|}nt|}t|}||_ |||_ |_ ht f|_ |||_|_t|i|id|_||_| |_|o_x\|iddD]A} d| id| idf|jo| d|_PqqWn|d j o d} |i||d | Snd S( s Change advanced properties The arguments are: max_rows -- The maximum number of rows to be returned from a query. max_cache -- The maximum number of results to cache cache_time -- The maximum amound of time to use a cached result. class_name -- The name of a class that provides additional attributes for result record objects. This class will be a base class of the result record class. class_file -- The name of the file containing the class definition. The class file normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the class file is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. it_getProductRegistryDatatzclassess%s/%stproductR#t meta_classs+ZSQL Method advanced settings have been setRRN(ttypetmax_rowstatoit max_cachet cache_timeR"t class_namet class_fileR$t max_rows_t max_cache_t cache_time_R[R\t class_name_t class_file_tgetBraint_v_braintdirectt#allow_simple_one_argument_traversaltconnection_hooktzclasst aq_acquiretdtgett_zclassRKtNonetmR!( R$RdRfRgRhRiRqRKRtRsRvRz((RR^s2     )   tPrincipiaSearchSourcecCsd|i|ifS(s-Return content for use by the Find machinery.s%s %sN(R$R<R=(R$((RR{ss text/plaint document_srccCs5|dj o|iddnd|i|ifS(s#Return unprocessed document source.s Content-Types text/plains%s %sN(R6Ryt setHeaderR$R<R=(R$RKR6((RR| s cCs*|iiiddd|i|ifS(sGet source for FTP downloads Content-Types text/plains%s %sN(R$RKR6R}R<R=(R$((Rt manage_FTPgetscCst|iS(N(tlenR$R|(R$((Rtget_sizestPUTcCs|i|||i||dd|idd}tid|ti ti B}|o8|i d|_ t|i |_||i}n|}||_|i||_}|ihtf|_|id|S(sHandle put requeststrefreshitBODYRs\s*(.*)\s* iN(R$t dav__initRKR6tdav__simpleifhandlerRwtbodytretmatchtItSRztgroupR<RVRWtendR)R=RXRYRZR[R\t setStatus(R$RKR6RRzRYR)((RRs    cCs:t|i|idd}ti|||ddS(t t manage_testst HTTP_REFERERRN(tdefault_input_formR$t title_or_idRWt input_srcR R RK(R$RKR((RR.s    Rc Csoy||dd}Wn d}nXf}d }}}z'y}||dd\}}t|do(t t |ddddd}n|i ot |i |}nd }Wn,ti\}}}d ||f}nXtid |t|f}t|||fh|i |<}|d j o#|id ||||d |n|SWd d }Xd S( sTest an SQL method.tsrc__is$Could not render the query template!ttest__ts t-i<s#This statement returned no results.s'Error, %s: %ss
%s
SQL used:
%s

N(R$RKR=tresultRyRYRttbtfindtjointsplitt_searchable_result_columnstcustom_default_reportR#trtsystexc_infoR R t html_quotetreporttapplytraise_standardErrorMessage( R$RKR=RRRRRRY((RR6s0 (  $ #t index_htmlcCs|iid|ddS(Rs%s/manage_testFormtURL1N(RKR6tredirect(R$RK((RR_scCs|iS(N(R$RW(R$((Rt_searchable_argumentscscCs|iS(N(R$t_col(R$((RRescCsit|dd}|djohtf}|_n|\}}|||f}|i }t} | |i}t||jol|i}x]|oQt||jp|d|jo-|d} || } || =|| =|d=qWn|i|o7||\} } | |jo| Sq9||=|| =n|i||}||| <| |f||<|S(NR\i(tgetattrR$RytcachesR[R\tcachettcachetqueryRdtconn_idt cache_keyRkRfttimetnowRlRYRtkeystkeytqRSR RtDB__R(R$RRRdRRRRRRRR RRRfRYRR((Rt_cached_resultgs6       +     t__call__cKsMt|f}|d jo8|o |}qQt|do |i}qQh}n|i}|i }|ot ||}nyt ||}Wn t j ot d|nXy |}Wntd|inXt|do'|i}|io |i}qnd }|i|}d|d<|i|d%s cannot be found.s!%s is not connected to a databaset aq_parentRt sql_delimitert sql_quote__tclientis'client' may not be used as an sargument name in this contextNRpR(=tSQLMethodTracebackSupplementR$t__traceback_supplement__RKRytkwthasattrR'tcRsthkRtdbctAttributeErrorRRR#Rtpt-_isBeingAccessedAsZClassDefinedInstanceMethodt_argdatatargdataRtgetSecurityManagertsecurityt addContextRR)Rt TypeErrortmsgR"Rt NameErrort removeContextRRlRkRRjRRptbrainRoRnRmRxtzct_zclass_RctStringIOtftwritetseektRDBtFiletResultsRtcolumnsRR(R$RKt__ick__RRRRRRRRRRRRRRRRRR((RRs|                          cCst|idjS(Ni(RR$RW(R$((Rtda_has_single_argument scCs|i}|ioxt|djoe|h|id|<}|o$t|djo t|qyn t||d}|Sn|i|t |h|S(Nii( R$RWtargsRrRRRtresultstKeyErrorRtTraverse(R$RRRR((Rt __getitem__s    cCs,t||iott||idS(Nt connected(RR$R'R(R$((RtconnectionIsValidscCstt||idS(NR(RR$R'(R$((RR!stmanage_product_zclass_infocCsg}|i}t|d|}x|iddD]o}|d}t|i doq7nh}|i |||jodpd|d<|d=|i |q7W|S(Ntaq_selfR_R`Rbt _p_deactivatetselectedR( RR$RxtZRRuRvtzRRtxRNtappend(R$RRvRRR((RR's   (RR(RsZ-SQL-Method_Edit.stx(RsZ-SQL-Method_Test.stx(RsZ-SQL-Method_Advanced.stx(ii(ii(ii(ii(ii(ii(:RRRtClassSecurityInfoRtdeclareObjectProtectedtuse_database_methodstsetPermissionDefaultRyRRjRlRkRmRnRxRrRRXRst AccessControltRolet RoleManagertmanage_optionstOFSt SimpleItemtItemR*tdeclareProtectedtview_management_screenstDTMLFiletglobalsR!t declarePublicR-R>ROtchange_database_methodsR%R^R{tdefault_content_typeR|R~RRRRRRRRRRRRRR(((RRGsj     z   < )C      (    LY     RcBs2tZdZeZedZdZdZRS(s@Helper class for 'traversing' searches during URL traversal cCs(d|_||_||_||_dS(N( RyR$t_rtdat_daRt_argstnamet_name(R$RRR((RR*Bs   c Cs|i}|id}|i}|o|i|oA||}t |t j o |g}n|i ||}n|||