バージョン 1 (更新者: weekbuild, 18 年 前) |
---|
ごみです。
#!/usr/local/bin/python # -*- coding: utf-8 -*- import sys import trac.scripts.admin import cmd import getpass import os import shlex import shutil import StringIO import time import traceback import urllib import time import calendar import re import mimetypes import email #from email.Parser import Parser from email.Header import decode_header #from email.Utils import collapse_rfc2231_value from email.Utils import decode_rfc2231 import types import os import email.Errors import email.Utils import mailbox from trac import util from trac.wiki import wiki_to_html, IWikiSyntaxProvider from trac.util import Markup from trac.web.chrome import add_link, add_stylesheet, INavigationContributor, ITemplateProvider from trac.attachment import attachments_to_hdf, Attachment from trac.util import NaivePopen import tempfile import getpass, poplib try: sum except NameError: def sum(list): """Python2.2 doesn't have sum()""" tot = 0 for item in list: tot += item return tot class MailArchiveAdmin(trac.scripts.admin.TracAdmin): __env = None env = None def msgfactory(self,fp): try: return email.message_from_file(fp) except email.Errors.MessageParseError: # Don't return None since that will # stop the mailbox iterator return '' def decode_to_unicode(self, basestr): #RFC2231の添付ファイル名はget_filenameではunicodeTypeでくるみたいだ if type(basestr) == types.UnicodeType : return basestr decodefrag = email.Header.decode_header(basestr) subj_fragments = ['',] for frag, enc in decodefrag: if enc: frag = self.to_unicode(frag, enc) subj_fragments.append(frag) return ''.join(subj_fragments)
添付ファイル
- デザインA.zip (238.9 kB) - 登録者 weekbuild 18 年 前.
- site_css.zip (107.9 kB) - 登録者 weekbuild 18 年 前.