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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? notification.py

?? trac是一款svn服務器的web客戶端
?? PY
?? 第 1 頁 / 共 2 頁
字號:
# -*- 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)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
高清在线不卡av| 婷婷综合久久一区二区三区| 国产精品一区一区三区| 久久日韩精品一区二区五区| 国产原创一区二区| 日本一区二区视频在线| aaa亚洲精品一二三区| 亚洲自拍偷拍综合| 日韩一级免费观看| 大胆亚洲人体视频| 一区二区三区日韩精品视频| 在线综合视频播放| 国产精品18久久久久久久久久久久 | 久色婷婷小香蕉久久| 日韩精品一区二区三区四区| 在线电影一区二区三区| 人禽交欧美网站| 久久久久国产精品免费免费搜索| 粉嫩一区二区三区性色av| 亚洲精品老司机| 欧美成人精品高清在线播放| 国产99久久久国产精品潘金网站| 怡红院av一区二区三区| 精品久久久久久综合日本欧美| 成人精品视频一区二区三区尤物| 亚洲一区精品在线| 久久奇米777| 欧美精品在欧美一区二区少妇| 国产一区二区三区免费看 | 福利电影一区二区| 亚洲成va人在线观看| 久久综合狠狠综合久久综合88| 91亚洲精华国产精华精华液| 日本不卡的三区四区五区| 国产精品久久久久久久久晋中 | 国产在线精品一区二区夜色 | 波多野结衣精品在线| 一区二区三区91| 久久精品视频一区二区| 在线播放91灌醉迷j高跟美女| 国产精品中文字幕欧美| 天天综合网 天天综合色| 中文字幕在线不卡一区二区三区| 日韩视频不卡中文| 在线视频你懂得一区二区三区| 韩国欧美一区二区| 日韩国产一区二| 亚洲人123区| 中文久久乱码一区二区| 日韩精品一区二区在线| 欧美性色黄大片| 91麻豆产精品久久久久久 | 成人性生交大片免费看中文| 麻豆91精品视频| 亚洲国产欧美日韩另类综合 | 日本欧美一区二区| 亚洲国产视频a| 亚洲另类色综合网站| 国产清纯美女被跳蛋高潮一区二区久久w| 91麻豆精品国产91| 欧美日韩高清在线播放| 欧美视频在线观看一区二区| 91色九色蝌蚪| 不卡区在线中文字幕| 成人深夜福利app| 成人一级黄色片| 成人av动漫网站| 白白色 亚洲乱淫| 成人免费视频app| 不卡一卡二卡三乱码免费网站| 国产不卡一区视频| 高清不卡一二三区| 国产成都精品91一区二区三| 国产精品资源在线看| 国产毛片精品一区| 国产成人鲁色资源国产91色综 | 国产电影精品久久禁18| 精品中文字幕一区二区 | 高清在线不卡av| 成人夜色视频网站在线观看| 东方aⅴ免费观看久久av| 国产91丝袜在线播放| 成人爽a毛片一区二区免费| av色综合久久天堂av综合| va亚洲va日韩不卡在线观看| 一本久久综合亚洲鲁鲁五月天 | 精品国产免费人成在线观看| 精品国产亚洲在线| 欧美激情一区二区三区四区| 国产精品毛片大码女人| 日韩毛片一二三区| kk眼镜猥琐国模调教系列一区二区| 国产91精品一区二区麻豆亚洲| 成人午夜视频在线| 色综合久久久久| 欧美日韩一二区| 日韩免费一区二区三区在线播放| 久久久99精品免费观看不卡| 中文字幕亚洲欧美在线不卡| 亚洲国产毛片aaaaa无费看| 日韩高清在线电影| 国产久卡久卡久卡久卡视频精品| 东方aⅴ免费观看久久av| 在线观看国产91| 亚洲精品在线三区| 国产精品久久久久久户外露出 | 欧美xxxx在线观看| 国产精品美女www爽爽爽| 亚洲国产成人av网| 国产精品一区免费视频| 色www精品视频在线观看| 日韩精品一区二区三区在线观看 | xf在线a精品一区二区视频网站| 中文字幕精品在线不卡| 亚洲一区精品在线| 国产精品99精品久久免费| 欧美最新大片在线看| www久久久久| 午夜激情一区二区| 大白屁股一区二区视频| 欧美日韩在线观看一区二区 | 尤物在线观看一区| 日韩国产精品久久| 91蝌蚪porny成人天涯| 日韩欧美中文字幕精品| 亚洲精品一二三| 国产成人自拍网| 91麻豆精品国产自产在线| 亚洲视频你懂的| 国产精品一二三在| 91精品国产乱| 亚洲精品免费在线观看| 国产美女一区二区三区| 91精品婷婷国产综合久久 | 亚洲午夜在线视频| 成人免费观看男女羞羞视频| 精品理论电影在线观看| 亚洲国产成人高清精品| 91在线观看免费视频| 久久青草欧美一区二区三区| 日本人妖一区二区| 欧美午夜一区二区三区| 国产精品久久国产精麻豆99网站| 日本三级亚洲精品| 欧美亚洲动漫精品| 亚洲精品国产成人久久av盗摄 | 国产精品一级在线| 精品日韩在线一区| 青青草97国产精品免费观看无弹窗版| 日本乱人伦一区| 亚洲三级理论片| 中文字幕精品三区| 韩国欧美国产一区| 精品国产不卡一区二区三区| 奇米四色…亚洲| 538在线一区二区精品国产| 亚洲国产精品天堂| 欧美日韩精品免费| 石原莉奈在线亚洲二区| 欧美色图第一页| 午夜精品久久久久久| 欧美日韩免费视频| 亚洲成a天堂v人片| 欧美日韩一区三区| 天堂成人免费av电影一区| 4438x亚洲最大成人网| 午夜av一区二区三区| 51精品国自产在线| 久久国内精品视频| 久久无码av三级| 国产91精品一区二区麻豆亚洲| 日本一区二区三区久久久久久久久不| 国产福利一区在线观看| 中文字幕不卡在线观看| 成人精品免费视频| 中文字幕色av一区二区三区| 色综合久久久久综合体桃花网| 一区二区三区国产精华| 欧美日韩卡一卡二| 精品午夜久久福利影院| 久久精子c满五个校花| 亚洲精品一区二区三区99| 欧美精品一区二区三区一线天视频| 国产女同互慰高潮91漫画| 成人精品免费视频| 日韩欧美www| 国产成人一区在线| ●精品国产综合乱码久久久久 | 本田岬高潮一区二区三区| 亚洲色图欧洲色图| 欧美一级淫片007| 国产成人av福利| 亚洲一区二区精品3399| 欧美大度的电影原声| 不卡大黄网站免费看| 午夜精品一区二区三区免费视频 | 国产精品色呦呦| 欧美色综合久久| 国产精品影视网| 亚洲一区二区三区四区在线|