;ς Ω…PCc@sdZdkZdkZdklZdklZdkZdklZdk l Z dk Z dk Z de fd„ƒYZde fd „ƒYZd fd „ƒYZd efd „ƒYZdklZeeƒeeƒd„Zd„Zdd„Zd„Zd„ZdS(s2 Utility classes & functions for ZSyncer and UIs. N(saq_base(sClassSecurityInfo(s DateTimeError(s html_quotesZSyncerConfigErrorcBstZdZRS(s?There is a problem with the configuration of this ZSyncer. (s__name__s __module__s__doc__(((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pysZSyncerConfigErrors sZSyncerObjNotFoundcBstZdZRS(s2ZSyncer could not find an object at the path. (s__name__s __module__s__doc__(((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pysZSyncerObjNotFounds sTextMsgcBs5tZdZdZdZd„Zd„Zd„ZRS(s,For logging & output of arbitrary text. sblackiΘcCs ||_dS(N(smsgsself(sselfsmsg((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys__init__+scCst|iƒSdS(N(sstrsselfsmsg(sself((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys__str__.scCsd|it|iƒfSdS(Ns
%s
(sselfscolors html_quotesmsg(sself((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pyshtml1s(s__name__s __module__s__doc__scolorsstatuss__init__s__str__shtml(((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pysTextMsg#s   s StatusMsgcBs,tZdZed„Zd„Zd„ZRS(s1For logging & output of remote call results. cCs―t|ƒ}t|tƒo |i}n||_|djo8ti|_|i dƒ od|}n||_n5ti |_dti i t |ƒdƒ|f|_dS(s/msg may be a text string or a TextMsg. iΘsOKsOK: %ss%s: %ssUnknown error!N(sintsstatuss isinstancesmsgsTextMsgsselfsConfigs color_200scolors startswiths color_errorserror_messagessgetsstr(sselfsmsgsstatusscontext((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys__init__;s       cCs'|i|ijo|i|ijSdS(N(sothersmsgsselfsstatus(sselfsother((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys__eq__MscCs!d|ii|i|ifSdS(Ns %s("%s", %s)(sselfs __class__s__name__smsgsstatus(sself((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys__repr__Qs(s__name__s __module__s__doc__sNones__init__s__eq__s__repr__(((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys StatusMsg6s   (s allow_classcCst|tiƒ o t‚n|iƒ}|idƒ}| odSng}xy|D]q}|iƒ}|ddfjoqVqV|djo+y|i ƒWqΗt j o qVqΗXqV|i |ƒqVWdi |ƒ}|o|ddjod|}n|SdS(s± utility function - does basically what os.path.normpath() does for filesystem paths, but for URLs instead. Does not verify whether anything exists at the path. s/ss.s..iN(s isinstancesurlstypess StringTypes TypeErrorsstripssplitselementss norm_elementssespops IndexErrorsappendsjoinsresult(surlseselementssresults norm_elements((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pysnormalizeRelativeURL`s.     cCsWt|ƒ}t|dtƒdjo&t|dtƒot|idtƒ}| SdS(Ns meta_typesZ Classspropertysheetssmethods(saq_basesobjsbase_objsgetattrsNonespropertysheetss is_zclass(sobjsbase_objs is_zclass((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pysisZClassFolders As cCs>t|ƒ}x'|o|| |jo||}qW|SdS(s¨Workaround for the fact that ''.lstrip() takes no arguments in python 2.1. This can be deleted and replaced with ''.lstrip() once we require zope 2.7. N(slensprefixspre_lensastring(sastringsprefixspre_len((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pyslstrip‡s  cCsvt|ƒtijo1yti|ƒ}WqGtj o dSqGXn|iƒ o d}nd}|i|ƒSdS(s‰Convert datetime to string representing time in local zone. The datetime arg can be either a string parsable by DateTime.DateTime(), or it can already be a DateTime instance. Output is sort of like that used by ls -l (i.e. only show year if it's not this year), e.g.: 'Aug 5 2003' or 'Sep 21 23:22'. If the input is a string that cannot be parsed, return ''. ss %b %d, %Ys %b %d %H:%MN( stypesdatetimestypess StringTypesDateTimes DateTimeErrors isCurrentYearsfmtsstrftime(sdatetimesfmt((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pysnormalize_time“s   cCsΤ|idƒ}|idƒ}x$|D]}|i|idƒƒq%Wg}x~|D]v}y"di |i |ddƒƒ}Wnt j o qRnXd|i ƒ|f}|ihd|<d|<ƒqRW|Sd S( s‡Get a list of dicts representing all acquirable syncers. Useful for ZMI 'sync' tab. Dictionary keys are: 'url', 'syncer'. sZSyncersPortal ZSyncer Tools/sstrictis%s/manage_sync?folder=%sssyncersurlN(scontexts superValuesszsyncersstoolsstoolsextends objectValuessurlsszssjoins_getRelativePhysicalPathsrel_paths ValueErrors absolute_urlsurlsappend(scontextszsyncerssurlstoolsrel_pathsurlsstoolsszs((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys listSyncers½s "#(s__doc__stypess Acquisitionsaq_bases AccessControlsClassSecurityInfosDateTimesDateTime.DateTimes DateTimeErrorsDocumentTemplate.DT_Utils html_quotesGlobalssConfigs ExceptionsZSyncerConfigErrorsZSyncerObjNotFoundsTextMsgs StatusMsgsProducts.PythonScripts.Utilitys allow_classsnormalizeRelativeURLsisZClassFolderslstripsnormalize_times listSyncers(snormalize_times StatusMsgsaq_bases DateTimeErrorsTextMsgsnormalizeRelativeURLsConfigsClassSecurityInfos allow_classsDateTimeslstripsZSyncerObjNotFoundsGlobalss listSyncersstypessZSyncerConfigErrorsisZClassFolders html_quotes Acquisition((s9/mnt/gmirror/ports/www/zope-zsyncer/work/ZSyncer/utils.pys?s*          !      *