; ECc@s dZdkZdkZdkZdkZdkZdkZdkZdkZdk l Z dk Z dk Z dkZdkZdkZ dklZdklZdklZdk lZlZlZdklZdklZlZlZlZd klZd kl Z d k!l"Z"d k#l$Z$d k%l&Z&l'Z'dk(l)Z)dk*l+Z+dk,l-Z-l.Z.dk/l0Z0l1Z1l2Z2l3Z3dk4Z4dk5l6Z7dk8l9Z9l:Z:dk8l;Z;l<Z<dk8Z8ydk=l>Z>Wne?j o e@Z>nXdk4lAZAdk4lBZBdk4lCZCdk4lDZDdZEdZFedeGZHdde@dZIde iJiKee iLeiMiNe iOiOfd YZPeePd!fd"YZQd#eQfd$YZRd%eQfd&YZSd'fd(YZTd)eTfd*YZUdS(+sq ZSyncer A Zope product that provides a synchronization service to copy (and compare) objects from one Zope server to another. Home page: http://zsyncer.sourceforge.net Release version: see version.txt Instructions: see README.txt Copyright: see LICENSE.txt Authors: see credits.txt Changelog: see changes.txt Future Plans: see TODO.txt N(sStringIO(sgetSecurityManager(sClassSecurityInfo(s Unauthorized(s aq_parentsaq_innersaq_base(sDateTime(sDTMLFiles MessageDialogs Persistents INSTANCE_HOME(sInitializeClass(sNotFound(sPageTemplateFile(sWriteLockInterface(sloadssdumps(sClient(s ConflictError(s html_diffsreplace(sjoinssplitsatoisstrip(s _MethodProxy(sZSyncerConfigErrorsZSyncerObjNotFound(sTextMsgs StatusMsg(sDefaultDublinCoreImpl(sOK(sEXTRA(sMISSING(sOODsZSyncer: Use ZSyncersView management screenssdtml/AddscCsG|i|t|||tj otddddddSndS(sAdds a ZSyncer instance. stitlesAddedsmessagesZSyncer sucessfully added.sactions manage_mainN(sselfs _setObjectsidsZSyncerstitlesREQUESTsNones MessageDialog(sselfsidstitlesREQUEST((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_addZSyncerPs   sZSyncercBsdtZdZdZeZhdd<dd<dddfZ"eied?e e d@Z#eiedAe e dBZ$eiedCe e dDZ%eiedEe e dFZ&eiedGe dHZ'eiedIe e dJZ(eiedKdLZ)eiedMe dNZ*eiedOdPdQZ+eiedRdSZ,dTZ-eiedUdVdWZ.dXZ/dYZ0ei1dZe e2d[Z3eied\d]Z4eied^d_Z5d`Z6daZ7dbZ8e e e dcZ9e e ddZ:deZ;e dfZ<e dgdhZ=d*diZ>e djZ?dkZ@dlZAdmZBdnZCdoZDdpZEeiedqeFdrZGeFdsZHeiedtduZIdvZJeiedwdxZKeiedydzZLeied{d|ZMeied}d~ZNeieddZOdZPeieddZQdZRdZSdVdZTeiede dZUeieddZVRS(sA service provider that allows you to 'push' objects from one running Zope to another across the network. You need one instance on both the source and destination servers. sZSyncerslabels Propertiessactionsmanage_propertiesFormshelps ZSyncer.stxsSyncs manage_syncsUndosmanage_UndoFormsOFSPsUndo.stxs Ownerships manage_owners Ownership.stxsSecuritys manage_accesss Security.stxsidstitlestypesstringsmodesws dest_serversslinesslogsbooleanslogfilesapprovalssyncablesmultiple selectionsselect_variablesuse_relative_pathssrelative_path_bases add_syncablesconnection_types filterObjectssfilterOutObjectss non_syncableiss ConnectionMgrsmanage_addPropertysmanage_editPropertiessmanage_delPropertiessmanage_changePropertiess manage_tabss dtml/Edits dtml/Syncsmanage_approvals dtml/Approvals manage_diffswww/Diffsmanage_folderss dtml/FoldercCs||_||_g|_d|_d|_ti|_ti i ddf|_ d|_ d|_ d|_d|_g|_g|_dS(s,initialize a new instance of Server islogs ZSyncer.logs ConnectionMgriN(sidsselfstitles dest_serversslogsapprovalsConfigssyncablesosspathsjoinslogfilesconnection_typesuse_relative_pathss filterObjectssfilterOutObjectss add_syncables non_syncable(sselfsidstitle((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys__init__s           smanage_approvedActionc Cs[d|g}|io|id|n|idd}|id||p|i ddi }|p|i ddi i }|ido|i|d |d |Sn|id o|i|d |d |Snk|id o|i|d |d |Sn>|id o|i|d |d |Sn|iddSdS(s[If this action is to be approved, throw that data in into the message list sUser: %ssApproved by: %ss ss Comments: %ssfoldersactionsputsmsgssREQUESTsdeletesgetstouchsmsgsUnknown actionN(ssyncersmsgssselfsapprovalsappendsapproverscommentssreplacesfoldersREQUESTsgetsstripsactionslowerscountsmanage_pushToRemotes object_pathssmanage_syncDeletesmanage_pullFromRemotes manage_touchs_error( sselfsREQUESTsactionsfolders object_pathsssyncersapproverscommentssmsgs((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_approvedActions(  % smanage_syncDeletecCs|tjo g}nt|tijo |g}n|i||dtx@|D]8}|i |t}|i t dt ||qWW|i|||SdS(s Interface to deleting both locally and remotely. object_paths may be a string or a sequence of strings. If msgs list is provided, it's modified in-place; it's also returned. sREQUESTsDeleting %s locallyN(smsgssNonestypes object_pathsstypess StringTypesselfsmanage_deleteRemotespathsmanage_replaceObjectsstatussappends StatusMsgsstrs _do_messagessREQUEST(sselfs object_pathssmsgssREQUESTsstatusspath((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_syncDeletes   $smanage_deleteRemotecCs|tjo g}nt|tijo |g}nx|D]{}xI|iD]>}d||f}|i ||}|i t||qQW|i o|i td|dqAqAW|i|||SdS(s@Interface to calling delete on each destination server. sObject %s deleting from %ss2Can't delete %s, No destination servers configurediN(smsgssNonestypes object_pathsstypess StringTypes object_idsselfs dest_serversssrvstexts _deleteRemotesstatussappends StatusMsgs _do_messagessREQUEST(sselfs object_pathssmsgssREQUESTsstatusstexts object_idssrv((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_deleteRemotes"     s manage_touchc Cst|tijo |g}n|tjo g}nt}g}xc|D][}|i |||i t d|dhdd<d||g<} |i | qPW|i||igi }|D]}|t d|dq~|i|||SdS(s Force timestamp of local and remote object(s) to *now*. A list of StatusMsgs or TextMsgs will be returned. sObject %s touched locally.isnamestouchsargssObject %s touching remotelyN(stypes object_pathsstypess StringTypesmsgssNonesDateTimes timestampsremote_methodss object_pathsselfstouchsappends StatusMsgs method_infoscallManyRemotesextends_[1]sps _do_messagessREQUEST( sselfs object_pathssmsgssREQUESTs_[1]sremote_methodss timestamps object_pathsps method_info((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys manage_touchs$      ;smanage_pushToRemotec Cst|tijo |g}n|tjo g}nddt|it|}|o|i o*t i } |id| |fn|id|d|} x*|D]"}| |it||7} qWx|D]}y|i|}WnJtj o>td|d} |i| | |i| |7} PnXxb|iD]W} |i| ||}td|| f|} |i| | |i| |7} qRWqW|i||| |Sd S( sInterface to pushing each object to destination server. The 'msgs' argument may be modified in-place, and will be returned as a list of TextMsg or StatusMsg instances. iis%s attempting to sync %ssREQUESTscontent_lengthscannot push %sisObject %s to %sN( stypes object_pathsstypess StringTypesmsgssNoneslensselfs dest_serversscontent_lengthsREQUESTslogsgetSecurityManagersgetUsersusers_logs _msg_headerswrittensms _do_one_msgsTextMsgs object_pathsmanage_getExportDatasdatasZSyncerObjNotFounds StatusMsgsmsgsappendssrvs_exportToRemotesstatuss _msg_footer( sselfs object_pathssmsgssREQUESTscontent_lengthsstatuss object_pathsmsdataswrittenssrvsusersmsg((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_pushToRemote"sB   !         smanage_pullFromRemotec Cst|tijo |g}n|tjo g}nt} xI|iD]>} y|i | } PWqJd| }|i |qJqJXqJW| tjo t dnddt|it|}|id|d|}||itd| |7}x|D]} td| } ||i| |7}y| i| }WnTd | }|i |td |d }|i|||i||7}qX|i| |td | d}|i|||i||7}qW|i||||Sd S(sMInterface to retrieving each object from destination server. s/Error in manage_pullFromRemote connecting to %ssUnable to connect to any serveriisREQUESTscontent_lengthsGetting objects from server %ssGetting "%s"...sERROR pulling %ss%s: check log for infois %s downloadedN(stypes object_pathsstypess StringTypesmsgssNones serverconnsselfs dest_serversssrvs_getServerConnserrs _logExceptionsZSyncerConfigErrorslenscontent_lengths _msg_headersREQUESTswrittens _do_one_msgsTextMsgsobj_pathsid_msgsmanage_getExportDatasdatas StatusMsgsmsgsappendsmanage_replaceObjects _msg_footer( sselfs object_pathssmsgssREQUESTscontent_lengthserrsdatasmsgswrittenssrvs serverconnsid_msgsobj_path((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_pullFromRemoteQsP         !       smanage_diffObjectcCsd}|i|}|i}y|i||}Wn*|i dd}|d7}d}nXt |t i jot d|i}nt |t i jot d|i}n|o d}nt||}hd|<d|<d |<d |i?}||} tt| ddp tAiB| odi | iC}gi }|iE|D]}||dq~}|o+t'i(d dd||iHd|q(q,tIt| iJjo| iKq,nt'i(d dd|dSdS(s If an object already exists at *obj_path*, delete it. If *data* is not None, treat is as a picked new object to add at that path. isNeed a non-empty object paths/iisDelete objectssImport/Export objectsiis_treesmoveObjectsByDeltasmove_objects_by_positionssZSynceris trying to import %s **is _p_Jar.importFile(_file) failed s... receiving %sisobj_parent._setObject failed s...receiving %ssmoveObjectToPositionsobj_parent.%s failed sisPrincipiaFolderishi8sclearing DAV locks from %s spathss%manage_replaceObject succeeded at %s N(Lsselfs_getRelativePhysicalPathsobj_paths ValueErrorsNotFoundsZSyncerObjNotFoundsdatastypestypess StringTypesobj_path_printablessplitsjoins_getSyncerRootsrootslens obj_parentsaq_basesrestrictedTraversesKeyErrorsgetSecurityManagerscheckPermissionsallowedspermsNonespositionsobj_parent_basesgetattrs isBTreeFoldershas_order_supportshas_ordered_object_managers objectIdssappends_[1]sidsstripsgetObjectPositionsget_object_positionsmanage_delObjectsszLOGsLOGsConfigsupload_threshold_kbytess thresholdsStringIOs_filestempfiles TemporaryFileswritesseeks_p_jars importFilesnew_objsmsgsclosesgetIds object_ids _setObjects methodnamesmoveObjectToPositions newpositionsmove_objects_by_positionss Control_PanelsDavLockss lockmanagersutilssisZClassFoldersgetPhysicalPathsnewpathsfindLockedObjectssps locked_pathss unlockObjectssWriteLockInterfaces__implements__s wl_clearLocks(sselfsobj_pathsdatashas_order_supports_files obj_parentsobj_path_printables isBTreeFolders object_idsalloweds thresholdsidspermsnew_objs locked_pathsshas_ordered_object_managersmsgs lockmanagers newpositionsnewpaths methodnamesobj_parent_bases_[1]spspositionscheckPermissionsroot((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_replaceObjects         `                 )4    s status_colourswhitecCstii||SdS(s8Gives a list of status colours for pretty html. N(sConfigscolourssgetsstatussdefault(sselfsstatussdefault((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys status_colourwss status_descrcCs&tii|tiiddSdS(s8Get description of each status from the config. sdefaultsN(sConfigs descriptionssgetsstatus(sselfsstatus((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys status_descr}s cCstii|d}|SdS(s1Get icon of each status from the config. sN(sConfigsiconssgetsstatusspath(sselfsstatusspath((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys status_iconssmanage_listObjectsic Csh}|i|}|i|}|o |i|o|i|}nh}t t |ddo|i }n-ti|o|iii }ng}xC|D];}|i| oqn|i|}|||d
sfolders/s" ------- Started syncing. -------N(swrittensREQUESTsNonesRESPONSEs setHeadersstrscontent_lengthsselfsabsolute_url_pathsgetsheadswriteslenslogsapprovals_log(sselfsREQUESTscontent_lengthsheadswritten((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _msg_headerPs %cCst|tj o>d}|ii||t|8}|iid|n|ip|i o|i dndS(Ns
DONE!
s sDone( sREQUESTsNonesfootsRESPONSEswritespaddingslensselfslogsapprovals_log(sselfsREQUESTspaddingsfoot((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _msg_footergs cCsd|ip|io|i|n|tjodSn|i}|ii |t |SdS(sXLog and/or display a single Msg. Return length of written html, if any. iN( sselfslogsapprovals_logsmsgsREQUESTsNoneshtmlsRESPONSEswriteslen(sselfsmsgsREQUESTshtml((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _do_one_msgvs  cCs|i}yt|iWntj o|iidoWd}|d7}|di |i 7}|d7}|d7}t i dt i |ntii t|i}t|d|_nX|iid|t|f|iidS( Ns/s6You have set an absolute path to the log file for yours ZSyncer instance at s.. You should probably make it relative to yours instance home.sZSyncersas%s %s (sselfs _get_timesm_timesaq_bases _v_logfilesAttributeErrorslogfiles startswithsmsgsjoinsgetPhysicalPathszLOGsLOGsPROBLEMsosspaths INSTANCE_HOMEsopenswritesstrsmsgssflush(sselfsmsgssm_timesmsgspath((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_logs     cCsR|i odSndititi}d||f}|i |dS(Ns s%s %s( sselfslogsjoins tracebacksformat_exceptionssyssexc_infosexcsmsgss_log(sselfsmsgssexc((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _logExceptions  cCs|d djo|d djod|}n|d djo|d d jod |}nti|\}}} }}}ti |\}} |t j o|i d \} } n.ti}|i|if\} } ti|| | |||f} |i}|d jotd | d| d| } n:|djotd | d| d| } ntd|| SdS(sHGet a connection to the server. OK to leave off http:// ishttp://ishttps://s http://%sishttp:ishttps:shttp:%ss:sZPublisher.Clientsserversuserspasswds ConnectionMgrsunknown connection type %sN(s server_urlsurlparsesprotosnetlocsurlsparamssquerysfragmentsurllibs splitusersauthshostsNonessplitsuserspwdsgetSecurityManagersgetUsersusgetIds _getPasswords urlunparsesselfsconnection_types conn_types _ZPCServersservers_ConnectionMgrServers ValueError(sselfs server_urlsquerysprotos conn_typesparamssfragmentsnetlocsauthshostsusersurlspwdsserversu((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_getServerConns&""! !    cCs |i|}|i|SdS(sTGet the list of remote stuff, in the format used by manage_compare. N(sselfs_getServerConns server_urls serverconnsmanage_listObjectsspath(sselfs server_urlspaths serverconn((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_getRemoteListscCs |i|}|i|SdS(s2Get the source text of the remote object. N(sselfs_getServerConns server_urls serverconnsmanage_getSources object_path(sselfs server_urls object_paths serverconn((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _srcRemotescCsJ|i|}y|i|t}Wn|idd}nX|SdS(s/Delete an object on the remote server. sException in _deleteRemoteiN( sselfs_getServerConns server_urls serverconnsmanage_replaceObjects object_pathsNonesresults _logException(sselfs server_urls object_pathsresults serverconn((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _deleteRemotes  stouchcCsrt|tptdt||i|}g}t t |d||j o ||_ nd|_ dS(s Force timestamp update to the (local) object. Optional timestamp arg must be a DateTime instance, and is set to the object's modification_date attribute IFF it has one. sinvalid timestamp: %ssmodification_dateiN(s isinstances timestampsDateTimesAssertionErrorstypesselfstraverseFromRoots object_pathsobsmarkersgetattrsaq_basesmodification_dates _p_changed(sselfs object_paths timestampsobsmarker((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pystouchs$ cCsN|i|}y|i||d}Wn|idd}nX|SdS(s0Touches an object on the remote server. isException in _touchRemoteiN( sselfs_getServerConns server_urls serverconnstouchs object_paths timestampsresults _logException(sselfs server_urls object_paths timestampsresults serverconn((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _touchRemotes   smanage_getExportDatacCsK|i|}|i|}t}|ii|i ||i SdS(s)Gets data suitable for transfer. N( sselfs_getRelativePhysicalPathspaths _getObjectsobjsStringIOsdatas_p_jars exportFiles_p_oidsgetvalue(sselfspathsobjsdata((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysmanage_getExportDatas  cCsY|i|}|i|}y|i||}Wn|i dd}nX|SdS(sGAdds a copy of the pickled 'data' object to the remote server. sException in _exportToRemoteiN( sselfs_getServerConns server_urls serverconns_getRelativePhysicalPathspathsobj_pathsmanage_replaceObjectsdatasresults _logException(sselfs server_urlspathsdatasresults serverconnsobj_path((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_exportToRemotes  s callRemotecOs/|i|}|i||||}|SdS(sFind an arbitrary callable at *path* on the remote server, call it with the given arguments, and return the result. If *path* is None, it's the remote syncer itself. N( sselfs_getServerConns server_urlsservers callMethod_spaths method_namesargsskwsresult(sselfs server_urlspaths method_namesargsskwsserversresult((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys callRemotesscallManyRemotecCsGg}x6|iD]+}|i|}|i|i|qW|SdS(s;Call multiple remote methods and return a list of return values, using as few requests as possible. methodlist should be a sequence of dictionaries with the following keys: 'path': (optional): path to the object on which to call the method, relative to the remote syncer's base. If not provided, the zsyncer itself is used. 'name': name of the method. 'args' (optional): list of positional arguments to pass. 'kwargs' (optional): dictionary of keyword arguments to pass. N( sresultssselfs dest_serverss server_urls_getServerConnsserversextends callMethods_s methodlist(sselfs methodlistsservers server_urlsresults((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pyscallManyRemote(s s callMethod_c Os|tjo |}n|i|}t||} t}|i ||||  o/|i i }d||f}t|n| ||} | SdS(sCall an arbitrary method (with security checks). *path* is path to the object. If it is None, the zsyncer itself will be used. *method_name* is method to call. Any result is returned. This is intended to be called by the client zsyncer, ONLY via callRemote(), but there is no way to enforce that. Note that for security reasons, you must have permission to use ZSyncer *and* to call the requested method in context. s&User %s is not allowed to call %s hereN(spathsNonesselfsobjstraverseFromRootsgetattrs method_namesmethodsgetSecurityManagerssmsvalidatesgetUsersgetIdsuserserrs Unauthorizedsargsskwsresult( sselfspaths method_namesargsskwsobjserrsuserssmsmethodsresult((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys callMethod_Gs     s callMethods_cCs{g}xj|D]b}|id}|d}|idg}|idh}|i|i ||||q W|SdS(sCall a list of arbitrary methods (with security checks). Return a list of results. *methodlist* is a list of dictionaries with these keys: 'path': path to the object on which to call the method, relative to the base folder. (optional, defaults to the syncer itself). 'name': name of the method. 'args' (optional): list of positional arguments to pass. 'kwargs' (optional): dictionary of keyword arguments to pass. This is intended to be called by the client zsyncer, ONLY via callManyRemote(), but there is no way to enforce that. Note that for security reasons, you must have permission to use ZSyncer *and* to call all the requested methods in context. spathsnamesargsskwargsN( sresultss methodlistsinfosgetspathsnamesargsskwargssappendsselfs callMethod_(sselfs methodlistsinfosargssresultsskwargsspathsname((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys callMethods_es #sgetSyncerRootPathcCs2|io|iipd}nd}|SdS(sf Get path to the root to use for traversing to syncable objects, as a string. ss/N(sselfsuse_relative_pathssrelative_path_basesstripsrootpath(sselfsrootpath((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysgetSyncerRootPaths  cCsF|i}|o|i|}ntt|}t|SdS(sK Get the object to use for traversing to syncable objects. N(sselfsgetSyncerRootPathsbasepathsunrestrictedTraverses syncer_roots aq_parentsaq_inner(sselfs syncer_rootsbasepath((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_getSyncerRoots  straverseFromRootcCst|tijo|id}n t|}|i}|i o:|i }t i di||}|id}nxU|D]M}|djoqny||}Wqttfj ot|qXqW|SdS(sL Find an object relative to the syncer root, without using acquisition. Assume that the path has already been normalized. Further assume that all objects we're traversing support __getitem__ syntax, as does e.g. ObjectManager. Raises ZSyncerObjNotFound in case of failure. s/sN(stypes relative_pathstypess StringTypessplitslistsselfs_getSyncerRootsobjsuse_relative_pathssgetSyncerRootPaths root_pathsutilsslstripsjoins temp_pathsnamesKeyErrorsAttributeErrorsZSyncerObjNotFound(sselfs relative_pathsobjsnames root_paths temp_path((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pystraverseFromRoots$      cCs|i}|djo||fSn9|djo|ii}nt|id}|t| |jo/ddi |di |f}t |n||t|fSdS(Ns/ss'%s' not within '%s'( sselfsgetSyncerRootPathsrootpathsobj_paths_getSyncerRootsgetPhysicalPathstuplessplitslensjoinsmsgs ValueError(sselfsobj_pathsrootpathsmsg((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys__splitAndValidatePaths   " cCst|tijot|iid}n|ddjot|djo|i |\}}n|i |}|SdS(s[ Get an object at the given path (which must be relative to the syncer root). Raises ZSyncerObjNotFound if no object is found. Should NOT acquire things above the syncer root; raises ValueError if an attempt to do so is made. n.b.: use this with output from '_getRelativePhysicalPath()'. s/isiN( stypespathstypess StringTypestuplesstripssplitslensselfs_ZSyncer__splitAndValidatePathsrootpathstraverseFromRootsobj(sselfspathsobjsrootpath((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _getObjects $cCst|titifjodi|}nt|tijo|i|}n|}|i }|i o|Sny|i |\}}Wn!tj o|oqnX|SdS(sn Get a clean *physical* path to the object or path, either relative to this zsyncer's container or relative to the app root, depending on setting of the use_relative_paths property. n.b.: this is the complement of '_getObject()'. If *obj_or_path* is a path, it can be either a string or a tuple. Return value is a sequence of path elements, e.g. as returned by getPhysicalPath(). If 'strict' is true, object must be somewhere within the container given by getSyncerRootPath() or we'll raise ValueError. True by default. If 'strict' is false and we're using relative paths and the object is not within getSyncerRootPath(), the result is undefined. If object doesn't exist, the underlying error is propagated (e.g. KeyError or NotFound). s/N(stypes obj_or_pathstypess TupleTypesListTypesjoins StringTypesselfs _getObjectsobjsgetPhysicalPathsobj_pathsuse_relative_pathss_ZSyncer__splitAndValidatePathsrootpaths ValueErrorsstrict(sselfs obj_or_pathsstrictsobjsrootpathsobj_path((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_getRelativePhysicalPaths   scall_c Cst|\}}}yOt||}ti |||| o t n|||}d}Wn?t j o n+|idtid }d}nXt||fdSdS(s *request* (poorly named, but changing it breaks stuff) is not an HTTPRequest, rather it should be a pickled tuple containing method_name (string), arguments (a sequence), and keyword arguments (a dictionary). Return value is a pickled tuple of (success, value) where success is boolean and value is the return value of getattr(self, method_name)(*args, **kwargs) isException in call_iiN(sloadssrequests method_namesargsskwsgetattrsselfsmethodsgetSecurityManagersvalidates Unauthorizedsresultsoks ConflictErrors _logExceptionssyssexc_infosdumps( sselfsrequestsREQUESTsoksargss method_nameskwsresultsmethod((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pyscall_ s     supgradecCsg}xRddddfD]>}tt||o"|id|t||qqWtt|dt}|tjp|i o|id|i nt |t it ifjot|}n |g}||_ d|_d d i||i fSd S( s> upgrade from 0.5.1 (or earlier?) to current version. suserspwdsoverrides override_usersDeleting attribute %ss dest_servers!No old destinations to fix for %sis%s Upgraded %s OKs N(soutsattrshasattrsaq_basesselfsappendsdelattrsgetattrsNonesold_dests dest_serverssgetIdstypestypessListTypes TupleTypeslists _p_changedsjoin(sselfsoutsold_destsattr((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysupgradeHs    (Ws__name__s __module__s__doc__s meta_typesClassSecurityInfossecuritysmanage_optionss _propertiess filterObjectssfilterOutObjectss add_syncables non_syncablesuse_relative_pathssrelative_path_basesconnection_typesdeclareProtectedsZSYNC_PERMISSIONsMGT_SCR_PERMISSIONsDTMLFilesglobalss manage_mainsmanage_propertiesForms manage_syncsmanage_approvalsPageTemplateFiles manage_diffsmanage_foldersstuplesConfigssyncables dest_serverss__init__sNonesmanage_approvedActionsmanage_syncDeletesmanage_deleteRemotes manage_touchsmanage_pushToRemotesmanage_pullFromRemotesmanage_diffObjectsmanage_comparesmanage_getSourcesmanage_replaceObjects status_colours status_descrs status_iconsmanage_listObjectss_isComparisonAlloweds_getInfoForObjectsdeclarePrivatesOKs is_diffables getPathInfosgetErrorAdvices _isReserveds _get_statuss_getFirstDestinations _compare_paths_errors _get_times _do_messagess _msg_headers _msg_footers _do_one_msgs_logs _logExceptions_getServerConns_getRemoteLists _srcRemotes _deleteRemotesDateTimestouchs _touchRemotesmanage_getExportDatas_exportToRemotes callRemotescallManyRemotes callMethod_s callMethods_sgetSyncerRootPaths_getSyncerRootstraverseFromRoots_ZSyncer__splitAndValidatePaths _getObjects_getRelativePhysicalPathscall_supgrade(((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pysZSyncerZs      .2 "      '  #   B 0  > g     !         '  "   0 's _BaseServercBstZdZdZRS(sfAuxiliary class to call the server. Derived classes should define __getattr__(self, method). cCs|||f|_dS(s server: url of server to connect to, including path to ZSyncer user: user id passwd: plain-text passwd N(sserversuserspasswdsselfs_info(sselfsserversuserspasswd((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys__init__hs(s__name__s __module__s__doc__s__init__(((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _BaseServerbs s _ZPCServercBstZdZdZRS(sYAuxiliary class to call the server via ZPublisher.Client. Used for http syncing. cCst|i|SdS(N(s_ZPCMethodProxysselfs_infosmethod(sselfsmethod((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys __getattr__ws(s__name__s __module__s__doc__s __getattr__(((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys _ZPCServerqs s_ConnectionMgrServercBstZdZdZRS(s_Auxiliary class to call the server via ConnectionMgr. Used for http and https syncing. cCst|i|}|SdS(N(s_ConnectionMgrMethodProxysselfs_infosmethodsproxy(sselfsmethodsproxy((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys __getattr__s(s__name__s __module__s__doc__s __getattr__(((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_ConnectionMgrServer{s s_BaseMethodProxycBstZdZdZRS(sxWraps a method so we can call it on a remote server. Derived classses should define __call__(self, *args, **kw) cCs||_||_dS(sU info = (server, user, password) method = the method to wrap N(sinfosselfs_infosmethods_method(sselfsinfosmethod((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys__init__s (s__name__s __module__s__doc__s__init__(((s;/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/ZSyncer.pys_BaseMethodProxys s_ZPCMethodProxycBstZdZdZRS(sSWraps a method so we can call it on a remote server via ZPublisher.Client. c Os|i\}}} ti|dddd|d| }d|id