;ò )äHEc@sdkZdkZdkZdkZdkZdkZdklZlZdk l Z dk l Z dk lZlZdklZdklZdklZdkZdklZd klZlZlZlZlZlZlZd fd „ƒYZ ee ƒdS( N(s UnixMailboxsPortableUnixMailbox(squote(sStringIO(sgetSecurityManagersClassSecurityInfo(sabsattr(sDateTime(sInitializeClass(s fromlineexpr(sBLATHERs html_quotesDateTimeSyntaxErrors stringBeforesstringBeforeAndIncludings stringAftersstringAfterAndIncludingsPageCommentsSupportcBs#tZdZeƒZeieidƒd„Zeieidƒd„Z eieidƒd„Z eieidƒd„Z e Z eieid ƒd „Z eieid ƒd „Zd „Zd„Zd„Zeieidƒed„ZeZe Ze Ze ZeZeZRS(sÇ I manage comments stored as rfc2822 messages in a wiki page. This mixin class looks for comments in mbox/RFC2822 format in the page text, and provides services for parsing and displaying them. Everything above the first comment is considered the document part, the rest of the page is considered the discussion part. Prior to 0.30 we called this MessageSupport. When working with comments, we represent them as email.Message.Message objects. So that we can recognize comments/messages without extra markup or too many false positives, we require each message to begin with BAW's "strict" From line regexp from the python mailbox module. See also Editing.py. ssupportsCommentscCs tid|iƒƒtj SdS(s0does this page parse embedded rfc2822 messages ?s (?i)(msg)N(sressearchsselfs pageTypeIdsNone(sself((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pyssupportsComments*ss hasCommentscCs|iƒdjSdS(s8does this page have one or more rfc2822-style comments ?iN(sselfs messageCount(sself((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pys hasComments/ss commentCountcCs ttit|iƒƒƒSdS(s6 The number of comments in this page. N(slensresfindalls fromlineexprsselfsdiscussionPart(sself((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pys commentCount4ss documentPartcCs!tit|iƒdƒdSdS(sR This page's text from beginning up to the first message, if any. iiN(sressplits fromlineexprsselfstext(sself((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pys documentPart;ssdiscussionPartcCstt|iƒƒSdS(sM This page's text from the first comment to the end (or ''). N(sstringAfterAndIncludings fromlineexprsselfstext(sself((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pysdiscussionPartDssmailboxcs)‡d†}ttˆiƒƒ|ƒSdS(sU Return the messages on this page as a Mailbox (iterator of Message) csHyti|ƒSWn0tiij otdˆiƒƒdSnXdS(Nsmessage parsing error ins(semailsmessage_from_filesfpsErrorssMessageParseErrorsBLATHERsselfsid(sfp(sself(s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pys msgfactoryRs N(s msgfactorys UnixMailboxsStringIOsselfstext(sselfs msgfactory((sselfs8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pysmailboxKs cCsTg}|iƒ}|iƒ}x+|tj o|i|ƒ|iƒ}q!W|SdS(sD Return this page's comments as a list of Messages. N(smsgssselfsmailboxsmboxsnextsmsNonesappend(sselfsmsmboxsmsgs((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pyscommentsZs    c Csªtidd|ƒpd}yct|ƒ}d||iƒ|iƒ|iƒ|i ƒ|i ƒ|i ƒ|i ƒ|i ƒf SWn$tttfj od|SnXdS(sš Generate a conformant mbox From line from email and date strings. (unless date is unparseable, in which case we omit that part) s\sssunknowns&From %s %s %s %d %02d:%02d:%02d %s %d sFrom %s N(sressubsemailsDateTimesdatesdsaDaysaMonthsdayshoursminutessecondstimezonesyearsDateTimeSyntaxErrorsAttributeErrors IndexError(sselfsemailsdatesd((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pys fromLineFromis WcCso|idƒ|iƒdd}t|dƒo,|tidd|ii ddƒƒ7}nd|}|Sd S( sQ Generate a somewhat unique email message-id based on a DateTime s %Y%m%d%H%M%Siûÿÿÿs@sREQUESTshttp://ss SERVER_URLs<%s>N( stimesstrftimesrfc822smsgidshasattrsselfsressubsREQUESTsget(sselfstimesmsgid((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pysmessageIdFromTimeys !, supgradeCommentscCsdS(sA Update the format of any comments on this page. N((sselfsREQUEST((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pysupgradeComments„s(s__name__s __module__s__doc__sClassSecurityInfossecuritysdeclareProtecteds PermissionssViewssupportsCommentss hasCommentss commentCounts documentPartsdocumentsdiscussionPartsmailboxscommentss fromLineFromsmessageIdFromTimesNonesupgradeCommentsssupportsMessagess hasMessagess messageCounts messagesPartsmessagessupgradeMessages(((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pysPageCommentsSupports4            (!ssyssossstringsresemails email.Errorssmailboxs UnixMailboxsPortableUnixMailboxsurllibsquotes cStringIOsStringIOs AccessControlsgetSecurityManagersClassSecurityInfos App.CommonsabsattrsDateTimesGlobalssInitializeClasss PermissionssRegexpss fromlineexprsUtilssBLATHERs html_quotesDateTimeSyntaxErrors stringBeforesstringBeforeAndIncludings stringAftersstringAfterAndIncludingsPageCommentsSupport(sstringAfterAndIncludingsossDateTimes stringAfters stringBeforesstringBeforeAndIncludingsresPageCommentsSupportsabsattrsemailsDateTimeSyntaxErrorsstrings UnixMailboxsquotesClassSecurityInfosInitializeClasssPortableUnixMailboxssyssBLATHERs fromlineexprsStringIOsgetSecurityManagers Permissionss html_quote((s8/mnt/gmirror/ports/www/zope-zwiki/work/ZWiki/Comments.pys?s6       1‘