亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? notification.py

?? trac是一款svn服務(wù)器的web客戶端
?? PY
?? 第 1 頁 / 共 2 頁
字號(hào):
# -*- coding: utf-8 -*-## Copyright (C) 2005-2006 Edgewall Software# Copyright (C) 2005-2006 Emmanuel Blot <emmanuel.blot@free.fr># All rights reserved.## This software is licensed as described in the file COPYING, which# you should have received as part of this distribution. The terms# are also available at http://trac.edgewall.org/wiki/TracLicense.## This software consists of voluntary contributions made by many# individuals. For the exact contribution history, see the revision# history and logs, available at http://trac.edgewall.org/log/.## Include a basic SMTP server, based on L. Smithson # (lsmithson@open-networks.co.uk) extensible Python SMTP Server#from trac.core import TracErrorfrom trac.util.datefmt import utcfrom trac.ticket.model import Ticketfrom trac.ticket.notification import TicketNotifyEmailfrom trac.test import EnvironmentStub, Mock, MockPermfrom trac.tests.notification import SMTPThreadedServer, parse_smtp_message, \                                    smtp_address                                    import base64from datetime import datetimeimport osimport quopriimport reimport timeimport unittestSMTP_TEST_PORT = 8225MAXBODYWIDTH = 76notifysuite = Noneclass NotificationTestCase(unittest.TestCase):    """Notification test cases that send email over SMTP"""        def setUp(self):        self.env = EnvironmentStub(default_data=True)        self.env.config.set('project','name', 'TracTest')        self.env.config.set('notification', 'smtp_enabled', 'true')        self.env.config.set('notification', 'always_notify_owner', 'true')        self.env.config.set('notification', 'always_notify_reporter', 'true')        self.env.config.set('notification', 'smtp_always_cc',                             'joe.user@example.net, joe.bar@example.net')        self.env.config.set('notification', 'use_public_cc', 'true')        self.env.config.set('notification', 'smtp_port', str(SMTP_TEST_PORT))        self.env.config.set('notification', 'smtp_server','localhost')        self.req = Mock(href=self.env.href, abs_href=self.env.abs_href, tz=utc,                        perm=MockPerm())    def tearDown(self):        """Signal the notification test suite that a test is over"""        notifysuite.tear_down()    def test_recipients(self):        """To/Cc recipients"""        ticket = Ticket(self.env)        ticket['reporter'] = '"Joe User" <joe.user@example.org>'        ticket['owner']    = 'joe.user@example.net'        ticket['cc']       = 'joe.user@example.com, joe.bar@example.org, ' \                             'joe.bar@example.net'        ticket['summary'] = 'Foo'        ticket.insert()        tn = TicketNotifyEmail(self.env)        tn.notify(ticket, newticket=True)        recipients = notifysuite.smtpd.get_recipients()        # checks there is no duplicate in the recipient list        rcpts = []        for r in recipients:            self.failIf(r in rcpts)            rcpts.append(r)        # checks that all cc recipients have been notified        cc_list = self.env.config.get('notification', 'smtp_always_cc')        cc_list = "%s, %s" % (cc_list, ticket['cc'])        for r in cc_list.replace(',', ' ').split():            self.failIf(r not in recipients)        # checks that owner has been notified        self.failIf(smtp_address(ticket['owner']) not in recipients)        # checks that reporter has been notified        self.failIf(smtp_address(ticket['reporter']) not in recipients)    def test_no_recipient(self):        """No recipient case"""        self.env.config.set('notification', 'smtp_always_cc', '')        ticket = Ticket(self.env)        ticket['reporter'] = 'anonymous'        ticket['summary'] = 'Foo'        ticket.insert()        tn = TicketNotifyEmail(self.env)        tn.notify(ticket, newticket=True)        sender = notifysuite.smtpd.get_sender()        recipients = notifysuite.smtpd.get_recipients()        message = notifysuite.smtpd.get_message()        # checks that no message has been sent        self.failIf(recipients)        self.failIf(sender)        self.failIf(message)    def test_cc_only(self):        """Notification w/o explicit recipients but Cc: (#3101)"""        ticket = Ticket(self.env)        ticket['summary'] = 'Foo'        ticket.insert()        tn = TicketNotifyEmail(self.env)        tn.notify(ticket, newticket=True)        recipients = notifysuite.smtpd.get_recipients()        # checks that all cc recipients have been notified        cc_list = self.env.config.get('notification', 'smtp_always_cc')        for r in cc_list.replace(',', ' ').split():            self.failIf(r not in recipients)    def test_structure(self):        """Basic SMTP message structure (headers, body)"""        ticket = Ticket(self.env)        ticket['reporter'] = '"Joe User" <joe.user@example.org>'        ticket['owner']    = 'joe.user@example.net'        ticket['cc']       = 'joe.user@example.com, joe.bar@example.org, ' \                             'joe.bar@example.net'        ticket['summary'] = 'This is a summary'        ticket.insert()        tn = TicketNotifyEmail(self.env)        tn.notify(ticket, newticket=True)        message = notifysuite.smtpd.get_message()        (headers, body) = parse_smtp_message(message)        # checks for header existence        self.failIf(not headers)        # checks for body existance        self.failIf(not body)        # checks for expected headers        self.failIf('Date' not in headers)        self.failIf('Subject' not in headers)        self.failIf('Message-ID' not in headers)        self.failIf('From' not in headers)    def test_date(self):        """Date format compliance (RFC822)            we do not support 'military' format"""         date_str = r"^((?P<day>\w{3}),\s*)*(?P<dm>\d{2})\s+" \                   r"(?P<month>\w{3})\s+(?P<year>200\d)\s+" \                   r"(?P<hour>\d{2}):(?P<min>[0-5][0-9])" \                   r"(:(?P<sec>[0-5][0-9]))*\s" \                   r"((?P<tz>\w{2,3})|(?P<offset>[+\-]\d{4}))$"        date_re = re.compile(date_str)        # python time module does not detect incorrect time values        days = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']        months = ['Jan','Feb','Mar','Apr','May','Jun', \                  'Jul','Aug','Sep','Oct','Nov','Dec']        tz = ['UT','GMT','EST','EDT','CST','CDT','MST','MDT''PST','PDT']        ticket = Ticket(self.env)        ticket['reporter'] = '"Joe User" <joe.user@example.org>'        ticket['summary'] = 'This is a summary'        ticket.insert()        tn = TicketNotifyEmail(self.env)        tn.notify(ticket, newticket=True)        message = notifysuite.smtpd.get_message()        (headers, body) = parse_smtp_message(message)        self.failIf('Date' not in headers)        mo = date_re.match(headers['Date'])        self.failIf(not mo)        if mo.group('day'):            self.failIf(mo.group('day') not in days)        self.failIf(int(mo.group('dm')) not in range(1,32))        self.failIf(mo.group('month') not in months)        self.failIf(int(mo.group('hour')) not in range(0,24))        if mo.group('tz'):            self.failIf(mo.group('tz') not in tz)    def test_bcc_privacy(self):        """Visibility of recipients"""        def run_bcc_feature(public):            # CC list should be private            self.env.config.set('notification', 'use_public_cc',                                public and 'true' or 'false')            self.env.config.set('notification', 'smtp_always_bcc',                                 'joe.foobar@example.net')            ticket = Ticket(self.env)            ticket['reporter'] = '"Joe User" <joe.user@example.org>'            ticket['summary'] = 'This is a summary'            ticket.insert()            tn = TicketNotifyEmail(self.env)            tn.notify(ticket, newticket=True)            message = notifysuite.smtpd.get_message()            (headers, body) = parse_smtp_message(message)            if public:                # Msg should have a To list                self.failIf('To' not in headers)                # Extract the list of 'To' recipients from the message                to = [rcpt.strip() for rcpt in headers['To'].split(',')]            else:                # Msg should not have a To list                self.failIf('To' in headers)                # Extract the list of 'To' recipients from the message                to = []                        # Extract the list of 'Cc' recipients from the message            cc = [rcpt.strip() for rcpt in headers['Cc'].split(',')]            # Extract the list of the actual SMTP recipients            rcptlist = notifysuite.smtpd.get_recipients()            # Build the list of the expected 'Cc' recipients             ccrcpt = self.env.config.get('notification', 'smtp_always_cc')            cclist = [ccr.strip() for ccr in ccrcpt.split(',')]            for rcpt in cclist:                # Each recipient of the 'Cc' list should appear                 # in the 'Cc' header                self.failIf(rcpt not in cc)                # Check the message has actually been sent to the recipients                self.failIf(rcpt not in rcptlist)            # Build the list of the expected 'Bcc' recipients             bccrcpt = self.env.config.get('notification', 'smtp_always_bcc')            bcclist = [bccr.strip() for bccr in bccrcpt.split(',')]            for rcpt in bcclist:                # Check none of the 'Bcc' recipients appears                 # in the 'To' header                self.failIf(rcpt in to)                # Check the message has actually been sent to the recipients                self.failIf(rcpt not in rcptlist)        run_bcc_feature(True)        run_bcc_feature(False)    def test_short_login(self):        """Email addresses without a FQDN"""        def _test_short_login(enabled):            ticket = Ticket(self.env)            ticket['reporter'] = 'joeuser'            ticket['summary'] = 'This is a summary'            ticket.insert()            # Be sure that at least one email address is valid, so that we             # send a notification even if other addresses are not valid            self.env.config.set('notification', 'smtp_always_cc',                                'joe.bar@example.net')            if enabled:                self.env.config.set('notification', 'use_short_addr', 'true')            tn = TicketNotifyEmail(self.env)            tn.notify(ticket, newticket=True)            message = notifysuite.smtpd.get_message()            (headers, body) = parse_smtp_message(message)            # Msg should not have a 'To' header            if not enabled:                self.failIf('To' in headers)            else:                tolist = [addr.strip() for addr in headers['To'].split(',')]            # Msg should have a 'Cc' field            self.failIf('Cc' not in headers)            cclist = [addr.strip() for addr in headers['Cc'].split(',')]            if enabled:                # Msg should be delivered to the reporter                self.failIf(ticket['reporter'] not in tolist)            else:                # Msg should not be delivered to joeuser                self.failIf(ticket['reporter'] in cclist)            # Msg should still be delivered to the always_cc list            self.failIf(self.env.config.get('notification',                        'smtp_always_cc') not in cclist)        # Validate with and without the short addr option enabled        for enable in [False, True]:            _test_short_login(enable)    def test_default_domain(self):        """Default domain name"""        def _test_default_domain(enabled):            self.env.config.set('notification', 'always_notify_owner',                                'false')            self.env.config.set('notification', 'always_notify_reporter',                                'false')            self.env.config.set('notification', 'smtp_always_cc', '')            ticket = Ticket(self.env)            ticket['cc'] = 'joenodom, joewithdom@example.com'            ticket['summary'] = 'This is a summary'            ticket.insert()            # Be sure that at least one email address is valid, so that we             # send a notification even if other addresses are not valid            self.env.config.set('notification', 'smtp_always_cc',                                'joe.bar@example.net')            if enabled:                self.env.config.set('notification', 'smtp_default_domain',                                    'example.org')            tn = TicketNotifyEmail(self.env)            tn.notify(ticket, newticket=True)            message = notifysuite.smtpd.get_message()            (headers, body) = parse_smtp_message(message)            # Msg should always have a 'Cc' field            self.failIf('Cc' not in headers)            cclist = [addr.strip() for addr in headers['Cc'].split(',')]            self.failIf('joewithdom@example.com' not in cclist)            self.failIf('joe.bar@example.net' not in cclist)            if not enabled:                self.failIf(len(cclist) != 2)                self.failIf('joenodom' in cclist)            else:                self.failIf(len(cclist) != 3)                self.failIf('joenodom@example.org' not in cclist)        # Validate with and without a default domain        for enable in [False, True]:            _test_default_domain(enable)    def test_email_map(self):        """Login-to-email mapping"""        self.env.config.set('notification', 'always_notify_owner', 'false')        self.env.config.set('notification', 'always_notify_reporter', 'true')        self.env.config.set('notification', 'smtp_always_cc',                            'joe@example.com')        self.env.known_users = [('joeuser', 'Joe User',                                'user-joe@example.com')]        ticket = Ticket(self.env)        ticket['reporter'] = 'joeuser'        ticket['summary'] = 'This is a summary'        ticket.insert()        tn = TicketNotifyEmail(self.env)        tn.notify(ticket, newticket=True)        message = notifysuite.smtpd.get_message()        (headers, body) = parse_smtp_message(message)        # Msg should always have a 'To' field        self.failIf('To' not in headers)        tolist = [addr.strip() for addr in headers['To'].split(',')]        # 'To' list should have been resolved to the real email address        self.failIf('user-joe@example.com' not in tolist)

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩国产一二三区| 69久久99精品久久久久婷婷| 色综合一个色综合亚洲| 欧美一级欧美一级在线播放| 欧美高清你懂得| 欧美色中文字幕| 欧美日韩视频在线一区二区| 欧美日韩国产在线播放网站| 欧美精品三级在线观看| 欧美成人vps| 国产日韩一级二级三级| 悠悠色在线精品| 亚洲午夜久久久久中文字幕久| 国产欧美一区二区三区鸳鸯浴| 精品剧情在线观看| 久久91精品久久久久久秒播| 日韩一区二区视频| 久久久久久久综合狠狠综合| 国产视频视频一区| 亚洲三级免费电影| 三级一区在线视频先锋| 狠狠色综合日日| 国产成人av一区二区| jizzjizzjizz欧美| 精品污污网站免费看| 日韩欧美成人一区| 中文一区二区完整视频在线观看| 欧美国产在线观看| 日本在线不卡一区| 成人午夜视频免费看| 欧美色网站导航| 精品蜜桃在线看| 欧美高清在线精品一区| 伦理电影国产精品| 色婷婷一区二区三区四区| 日韩午夜在线观看视频| 国产精品传媒在线| 日本在线播放一区二区三区| 91蜜桃视频在线| 欧美变态tickling挠脚心| 一色屋精品亚洲香蕉网站| 日韩有码一区二区三区| 成人av资源站| 久久久精品国产免大香伊| 亚洲五码中文字幕| 国产91丝袜在线观看| 欧美一区二区网站| 亚洲欧洲三级电影| 日本视频在线一区| 91看片淫黄大片一级在线观看| 欧美成人性福生活免费看| 国产精品进线69影院| 久久精品国产秦先生| 欧美在线观看视频一区二区| 国产欧美一区二区三区在线看蜜臀| 日日摸夜夜添夜夜添国产精品| 99精品久久免费看蜜臀剧情介绍| 日韩精品一区二区三区三区免费| 亚洲美女一区二区三区| 国产精一区二区三区| 欧美疯狂做受xxxx富婆| 亚洲日本护士毛茸茸| 国产精品一二三在| 日韩一区二区麻豆国产| 亚洲免费观看高清完整版在线| 国产伦精品一区二区三区在线观看| 7777精品伊人久久久大香线蕉超级流畅 | 激情文学综合网| 欧美三级日韩在线| 日韩一区中文字幕| 国产成人午夜视频| 日韩写真欧美这视频| 日精品一区二区三区| 欧美日韩精品福利| 亚洲永久精品大片| 欧美日韩一级视频| 亚洲大片精品永久免费| 欧美日免费三级在线| 一级中文字幕一区二区| 91老师国产黑色丝袜在线| 中文字幕在线观看一区| 成人免费电影视频| 中文在线资源观看网站视频免费不卡| 国产精品一二一区| 中文字幕高清不卡| 91在线你懂得| 亚洲一卡二卡三卡四卡五卡| 欧美熟乱第一页| 肉丝袜脚交视频一区二区| 欧美一区二区三区视频在线| 久久精品av麻豆的观看方式| 精品国内二区三区| 国产成人在线观看| 国产精品国产自产拍高清av | 91精品国产美女浴室洗澡无遮挡| 午夜精品123| 日韩免费视频一区| 国产精品18久久久久| 国产精品欧美一区喷水| 91一区二区在线观看| 亚洲一区二区三区影院| 91麻豆精品国产91久久久久久久久| 男女男精品网站| 精品国产一区二区三区av性色| 国产乱码字幕精品高清av| 国产精品短视频| 欧美四级电影在线观看| 奇米777欧美一区二区| 久久久久国产成人精品亚洲午夜| 国产91精品一区二区| 亚洲免费观看高清| 欧美一区二区三区在线电影| 狠狠网亚洲精品| 亚洲日本欧美天堂| 日韩欧美综合一区| 波多野结衣在线一区| 亚洲第一在线综合网站| 久久日韩精品一区二区五区| 91在线视频官网| 蜜乳av一区二区三区| ●精品国产综合乱码久久久久| 欧美日本国产一区| 国产91高潮流白浆在线麻豆| 一区二区三区不卡在线观看 | 亚洲成人中文在线| 精品国产三级电影在线观看| 97久久精品人人做人人爽| 日韩av在线发布| 中文字幕欧美日韩一区| 欧美日韩亚洲综合一区| 国产成人福利片| 五月激情综合色| 国产精品久久国产精麻豆99网站| 91麻豆精品国产91久久久久 | 国产精品久久三| 日韩视频免费观看高清完整版 | 亚洲欧美中日韩| 欧美一区二区高清| 91在线免费看| 国产美女久久久久| 日日摸夜夜添夜夜添国产精品| 中文字幕免费一区| 欧美一区二区久久| 日本精品免费观看高清观看| 久久se这里有精品| 亚洲国产成人高清精品| 国产精品毛片高清在线完整版| 91精品国产入口| 色综合网色综合| 国产精品亚洲第一| 蓝色福利精品导航| 亚洲成av人影院在线观看网| 国产精品国产a| 久久久久国产成人精品亚洲午夜| 69久久99精品久久久久婷婷| 91久久精品一区二区二区| 国产成人精品亚洲午夜麻豆| 久久99久久久久| 图片区日韩欧美亚洲| 亚洲乱码一区二区三区在线观看| 久久久精品天堂| 亚洲精品一区二区三区香蕉| 欧美精品电影在线播放| 欧美主播一区二区三区美女| 成人99免费视频| 国产成人免费9x9x人网站视频| 秋霞成人午夜伦在线观看| 亚洲国产成人tv| 亚洲综合色自拍一区| 亚洲三级小视频| 亚洲三级理论片| 亚洲桃色在线一区| 国产精品丝袜91| 久久久噜噜噜久久人人看| 日韩午夜在线影院| 欧美一级片在线| 日韩欧美国产不卡| 欧美大片一区二区三区| 91精品国产综合久久久久久漫画 | 亚洲精品高清在线观看| 亚洲欧洲国产专区| 中文字幕一区二区三区在线观看| 中文字幕成人网| 国产精品久久久久久户外露出| 国产欧美日韩另类一区| 国产午夜亚洲精品理论片色戒 | 成人午夜av电影| 成人中文字幕电影| 成人听书哪个软件好| 国产成a人亚洲| 丁香婷婷综合色啪| 成人免费高清在线| 91亚洲精品一区二区乱码| 色综合网站在线| 欧美性色综合网| 欧美日韩精品一区视频| 91精品国产福利| 精品久久久久久久一区二区蜜臀| 精品粉嫩超白一线天av| 久久久久国产免费免费|