m .Ec@s dZdkZdkZdkZdkZdkZdkZdkZdkl Z dk l Z dk l Z lZdkZdkZdkZdkZdkZdklZdklZdklZdklZd klZd klZd klZd klZd kl Z dk!l"Z"dk#l$Z$dk#l%Z%l&Z&dk#l'Z'dk#l(Z(l)Z)l*Z*dk+l,Z,dk-l.Z.dk/l0Z0dk1l2Z2dk3l4Z4dk5l6Z6dk7l8Z8dk9Z9dk:l;Z;dk<l<Z<dk=l>Z>dk?l@Z@dk?lAZAdk?lBZBd kClDZDd!kClEZEdkFZGe2ZHdkIZIheIiJeIiKei e?d0d1eeeed2Z@ei e?d3ed4eZAei e?d5ed d6ZBd d d7ZCd8ZDei eEd9d:ZFd;ZGei eEd<d=ZHd>ZIRS(AslGeneric object manager This class provides core behavior for collections of heterogeneous objects. t AnonymoustManagersObject Managert manage_mains dtml/mainsdtml/index_maintlabeltContentstactionthelptOFSPsObjectManager_Contents.stxiitgetSiteManagercCs'|idjotdn|iS(NsNo component registry defined.(Rt _componentsRtComponentLookupError(R((RR*ss Manage SitetsetSiteManagercCs ||_dS(N(t componentsRR+(RR.((RR-scCsyt|i}Wn g}nXxQ|iD]F}y6x/|iD]$}||jo|i|q@q@WWq-q-Xq-W|it ||_t |dS(N( tlistRt meta_typestmtt __bases__tbtttappendtsortttupletInitializeClass(RR3R1R4((Rt__class_init__s      c Csg}f}t|do |i}n2t|do!y|id}WqZqZXn|it|xHti D]=} |dj p| i dddjo|i| qwqwW|djo |} ng} x|D]} y}| i dd}|dj oZxW|D]K}xB|D]:}||jp|i|o| i| tqqWq WnWqtj oqXqW| it|i g}x\| D]T} | i dd}|djo|i| q||o|i| qqW|S(Nt_product_meta_typest aq_acquiret visibilitytGlobalt interfacestcontainer_filter(texternal_candidatest_pmtRRR:R;textendR/tProductsR0tentryR>RtgetR5t interface_constrained_meta_typesteilteititextendsR R?( RR>RHRIRARGR?R@R0RDRF((Rtall_meta_typessR  &       cCsti|iddS(Nt_getProductRegistryDatatac_permissions(RCt__ac_permissions__RR;(R((Rt_subobject_permissionsscCsti}g}t|io|i}n |i}xW|D]O}|i do,|i |d|o|i |qqE|i |qEW|S(Nt permission( tgetSecurityManagertgetUsertuserR0tcallableRRKtallt meta_typethas_keythas_permissionR5(RRSRURVR0((Rtfiltered_meta_typess cCst|||dS(N(tsetattrRRtobject(RRR[((Rt_setObscCst||dS(N(tdelattrRR(RR((Rt_delObscCsV|d djo'tt||ot||Sn|tjo t|n|S(NiR(RRRRRtdefaultt_markertAttributeError(RRR_((Rt_getObs '  cCsa|djp0|idp |idp|idotSntt||ddj S(sIndicate whether the folder has an item by ID. This doesn't try to be more intelligent than _getOb, and doesn't consult _objects (for performance reasons). The common use case is to check that an object does *not* exist. Rs..RRRN(Rs..(RRRtFalseRRRR(RR((Rt hasObject%s=c Cs|} |i|} | dj o | }nt| dd} x4|i D])}|d|jo|i |PqHqHW|pt t| ||n|i hd|<d| s(R7tmapRRk(R((Rt objectMapscCst|do |i}nf}|p|i|Sng}|i}x2|i|D]!}||jo||qZqZW|S(Nt_reserved_names( RRRtnRR4trR5taR(RR4RRRR((Rt objectIds_ds   cCst|i|i|S(N(RRRbRR4(RR4((RtobjectValues_dscCsLg}|i}|i}x-|i|D]}||||fq(W|S(N( RR5RRRbtgRR4R(RR4RRRR((Rt objectItems_ds  cCst|do |i}nf}|p |iSng}|i}x6|iD]+}|d|jo||i qNqNW|S(NRR( RRRRRkRR5RtdR(RR4RRRR((Rt objectMap_ds    c CsFt|tdjo |f}n|}h} g}f} | i}d}x|djot |dpPn|i }t |do}xz|i D]k}y[|d} | | f}|| o2|d|jo!|i|| d| |%s cannot be deleted.is Object "%s" is locked via WebDAVs%s does not existt update_menuiN(Rtidst MessageDialogRRtpRR RRbRjt wl_isLockedtResourceLockedErrorRsR RmRRR$(RRRRjRRR((RRs:            cCsg}tt|do|i}yt|}Wntj onXt|do|inx|D]0}t||o|i |i |qpqpWnh|i }|ixN|D]F}|i |}tt|do|io|i |qqW|S(Nttree_idsR6tisPrincipiaFolderish(RRRRRR/t TypeErrorR6RR5RbRtobj_idsRR(RRRRRR((RttpValuess* "   tmanage_exportObjectRc Cs|p0|i}t|do |}n|} n|i|} |odpd}|ot}|ot i | i | i |n| i i| i ||d j o.|idd|idd||fn|iSnt}tii|id||f}|ot i | i | i |n| i i| i ||d j o*|i||d d ||fd d Snd S(s2Exports an object to a file and returns that file.tim_functxmltzexps Content-typesapplication/datasContent-Dispositionsinline;filename=%s.%ss%s.%stmanage_tabs_messages0%s successfully exported to %sRsObject exportedN(RRRRhRbttoxmltsuffixtdownloadtStringIOtftXMLExportImportt exportXMLt_p_jart_p_oidt exportFiletRESPONSERt setHeadertgetvaluetgetConfigurationtcfgtostpathtjoint clienthomeRR$( RRRRRRRRRRh((RR*s6       "  tmanage_importExportFormsdtml/importExporttmanage_importObjectc Cstii|\}}|otdt|nt}x]|i |i fD]6}tii |d|}tii|oPqRqRWtdt||i|d| d||d j o*|i||ddtdd d d Snd S( sImport an object from a filesInvalid file name %stimportsFile does not exist: %stverifyRqRs!%s successfully importedRsObject importedRiN(RRtsplittfiletdirnameR R RRt instancehometzopehometimpathRtfilepathtexistsRt_importObjectFromFileRRqRR$R(RRRRqRRRR((RRRs$      cCs|i}|}x$|djo|i}|i}qW|i|dt}|o|i |ddn|i }t |do |}n|i||d||i|}|idddS(NtcustomImporterst validate_srciRRqtexplicit(RRt connectionRRRt importFileRRRhRt_verifyObjectPasteRRR|RqRbtmanage_changeOwnershipType(RRRRqRRhRR((RRjs     cCsg}t}|ig}|i|jo|i|inx|D]}ti i |d}ti i |pqFn|g}ti|D]1}|idp|ido ||qq~7}qFW|S(NRs.zexps.xml(tlistingRRRtpathsRR5RRRRt directorytisdirRtlistdirRR(RRRRRRRR((Rt list_imports~s  Vtmanage_FTPlistc Cs f}|}xFtii|otdnt|dpPn|i}qWt |i }|i idddjomti|} xQ|D]I}tt|ddo)|dio| it|dqqW| }n|i idd}|ot|d |}n|it|d o|ip|idd |ifn|idd |fx|D]y\} }yti|i|}Wn*t!i"d | dt#i$d}nX|dj o|| |ff}qqWti&|S(s#Directory listing for FTP. is*FTP List not supported on acquired objectsRt FTP_RECURSIVEiRtGLOBBINGRcCsti|d|S(Ni(tfnmatchRR(RR((RRst$isTopLevelPrincipiaApplicationObjects..RsFailed to stat file '%s'texc_infoN('toutRRhtApptCommont is_acquiredt ValueErrorRRR/RtfilesRtenvironRERt all_filesRRRRBt findChildrentglobbingtfilterR6RtinserttkRjtmarshaltloadstmanage_FTPstattstattLOGterrortsysRRtdumps( RRRRRRRRhRjRR((RRsH(      cCs/|d|ijot|dndS(s6 check if the folder has an object with REQUEST['id'] RN(RRRtKeyError(RR((Rt manage_hasIdsRc Cs7d}dkl}t|idjo|i|idijpry1ti d |d|i o|dB}nWnnX|i |t |d|i fo|dB}qn|ii}d}}x2|iD]$\}}d|jo |}PqqWti|d d d||d |||f S( s9Psuedo stat, used by FTP for directory listings. i@(snobodyiRiitZopeRfiN(tmodetAccessControl.UsertnobodytlenRtPARENTSRRRQtvalidateRRtallowedtgetRolestbobobase_modification_timettimeTimetmtimetownertgrouptget_local_rolesRSR{RR( RRRR{RRRRRS((RRs( 6     cCs|i|d}|dj o|Snt|doS|i}|idd}|i o*|djot |||i |Sqnt |dS(NRtREQUEST_METHODtGETtPOST(RR(RRbtkeyRRjRRtrequestREtmethodtmaybe_webdav_clientt NullResourcet__of__R(RRRRjR((Rt __getitem__s  !(R"R#(R)sObjectManager_Contents.stx(JRRt__doc__t implementstIObjectManagertClassSecurityInfotsecuritytdeclareObjectProtectedtaccess_contents_informationtsetPermissionDefaultRVR0RktdeclareProtectedtview_management_screenstDTMLFiletglobalsR$tmanage_index_maintmanage_optionstisAnObjectManagerRthas_order_supportRR+t declarePublicR*R-R9RKRORYRRiR\R^R`RbRdRcR|RgtTruet__five_method__RRRmRRRRRRRRRRtFactoryDispatchertProductDispatchertmanage_addProducttdelete_objectsRRtimport_export_objectsRRRRRt ftp_accessRRRR(((RR!s     $    4     /             ! $  5  RcCsg}x|iD]s\}}tt|do/|io%|it |||i dq|i ||i d||fqW|S(s_ recursive walk through the object hierarchy to find all children of an object (ajung) RRN( tlstRRtnametchildRRRRBRRRR5(RRR6R5R7((RRs  %&tIFAwareObjectManagercBstZddZRS(NcCso|djoRt|do |i}q_t|do!y|id}Wq[q[Xq_nti||S(Nt_product_interfacesR;(R>RRRR9R;R!RK(RR>((RRKs   (RRRRK(((RR8s(]RtwarningsRRRRRtretcgiR t cStringIORttypesR R t App.CommonRtApp.FactoryDispatcherRCtApp.Managementt Acquisitiont AccessControlRtAccessControl.PermissionsR%R"R2R4R3RQt AccessControl.ZopeSecurityPolicyR Rt App.configRtGlobalsR8R&t PersistentRRRRtwebdav.Collectiont Collectiontwebdav.LockableRtwebdav.NullResourceRt zExceptionsR tZODB.POSExceptiont ConflictErrortzope.interfaceRtzope.component.interfacesR,t CopySupportR>Rt Traversablet zope.eventRotzope.app.container.containedRvRRwt OFS.eventRpRtOFS.subscribersRxtBadRequestExceptionRtmagict importXMLRtcompiletsearchR Rt ExceptionRR R`t CopyContainert Managementt NavigationtTabstImplicitR!RR8(;RRHR,RORR!R4RRoR RRR R R RRpR2RRJR8R;RR"RvR%RRRR:R`RXR RR8R RRxRSRRCRRRBRRRRQRRR3R RRRR&RRRRw((Rt?sj  -                                  +:w