當前位置: 首頁>>代碼示例>>Python>>正文


Python Document.manage_FTPget方法代碼示例

本文整理匯總了Python中Products.CMFDefault.Document.Document.manage_FTPget方法的典型用法代碼示例。如果您正苦於以下問題:Python Document.manage_FTPget方法的具體用法?Python Document.manage_FTPget怎麽用?Python Document.manage_FTPget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Products.CMFDefault.Document.Document的用法示例。


在下文中一共展示了Document.manage_FTPget方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testSTX

# 需要導入模塊: from Products.CMFDefault.Document import Document [as 別名]
# 或者: from Products.CMFDefault.Document.Document import manage_FTPget [as 別名]
    def testSTX( self ):
        self.REQUEST['BODY']=SIMPLE_STRUCTUREDTEXT
        d = Document( 'foo' )
        d.PUT(self.REQUEST, self.RESPONSE)

        rnlinesplit = compile( r'\r?\n?' )

        get_text = d.manage_FTPget()
        simple_lines = rnlinesplit.split( SIMPLE_STRUCTUREDTEXT )
        get_lines = rnlinesplit.split( get_text )

        # strip off headers
        simple_headers = []
        while simple_lines and simple_lines[0]:
            simple_headers.append( simple_lines[0] )
            simple_lines = simple_lines[1:]

        get_headers = []
        while get_lines and get_lines[0]:
            get_headers.append( get_lines[0] )
            get_lines = get_lines[1:]

        self.assertEqual( get_lines, simple_lines )

        for header in simple_headers:
            self.failUnless( header in get_headers )
開發者ID:goschtl,項目名稱:zope,代碼行數:28,代碼來源:test_Document.py

示例2: testHTML

# 需要導入模塊: from Products.CMFDefault.Document import Document [as 別名]
# 或者: from Products.CMFDefault.Document.Document import manage_FTPget [as 別名]
    def testHTML( self ):
        REQUEST=fakeRequest()
        REQUEST['BODY']=SIMPLE_HTML
        d = Document( 'foo' )
        d.PUT(REQUEST, RESPONSE=fakeResponse())

        rnlinesplit = re.compile( r'\r?\n?' )
        simple_lines = rnlinesplit.split( SIMPLE_HTML )
        get_lines = rnlinesplit.split( d.manage_FTPget() )

        # strip off headers
        meta_pattern = re.compile( r'meta name="([a-z]*)" '
                                 + r'content="([a-z]*)"'
                                 )
        title_pattern = re.compile( r'<title>(.*)</title>' )
        simple_headers = []
        while simple_lines and simple_lines[0] != '<BODY>':
            header = string.lower( string.strip( simple_lines[0] ) ) 
            match = meta_pattern.search( header )
            if match:
                simple_headers.append( match.groups() )
            else:
                match = title_pattern.search( header )
                if match:
                    simple_headers.append( ( 'title', match.group(1) ) )
            simple_lines = simple_lines[1:]

        get_headers = []
        while get_lines and get_lines[0] != '<BODY>':
            header = string.lower( string.strip( get_lines[0] ) ) 
            match = meta_pattern.search( header )
            if match:
                get_headers.append( match.groups() )
            else:
                match = title_pattern.search( header )
                if match:
                    get_headers.append( ( 'title', match.group(1) ) )
            get_lines = get_lines[1:]

        self.assertEqual( get_lines, simple_lines )

        self.failUnless( get_headers )
        self.failUnless( simple_headers )
        self.failUnless( len( get_headers ) >= len( simple_headers ) )

        for header in simple_headers:
            self.failUnless( header in get_headers )
開發者ID:goschtl,項目名稱:zope,代碼行數:49,代碼來源:test_Document.py

示例3: testSTX

# 需要導入模塊: from Products.CMFDefault.Document import Document [as 別名]
# 或者: from Products.CMFDefault.Document.Document import manage_FTPget [as 別名]
    def testSTX( self ):
        REQUEST=fakeRequest()
        REQUEST['BODY']=SIMPLE_STRUCTUREDTEXT
        d = Document( 'foo' )
        d.PUT(REQUEST, RESPONSE=fakeResponse())

        simple_lines = string.split( SIMPLE_STRUCTUREDTEXT, '\n' )
        get_lines = string.split( d.manage_FTPget(), '\n' )

        # strip off headers
        simple_headers = []
        while simple_lines and simple_lines[0]:
            simple_headers.append( simple_lines[0] )
            simple_lines = simple_lines[1:]

        get_headers = []
        while get_lines and get_lines[0]:
            get_headers.append( get_lines[0] )
            get_lines = get_lines[1:]

        assert get_lines == simple_lines

        for header in simple_headers:
            assert header in get_headers, [header, get_headers]
開發者ID:goschtl,項目名稱:zope,代碼行數:26,代碼來源:test_Document.py


注:本文中的Products.CMFDefault.Document.Document.manage_FTPget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。