예제 #1
0
파일: Event.py 프로젝트: goschtl/zope
    def manage_FTPget(self):
        "Get the document body for FTP download (also used for the WebDAV SRC)"
        hdrlist = self.getMetadataHeaders()
        hdrtext = formatRFC822Headers( hdrlist )
        bodytext = '%s\r\n\r\n%s' % ( hdrtext, self.Description() )

        return bodytext
예제 #2
0
파일: Event.py 프로젝트: bendavis78/zope
    def manage_FTPget(self):
        "Get the document body for FTP download (also used for the WebDAV SRC)"
        hdrlist = self.getMetadataHeaders()
        hdrtext = formatRFC822Headers( hdrlist )
        bodytext = '%s\r\n\r\n%s' % ( hdrtext, self.Description() )

        return bodytext
예제 #3
0
    def test_formatRFC822Headers_multiline_trailing_blank_line(self):
        from Products.CMFDefault.utils import formatRFC822Headers

        HEADERS = [('Foo', 'foo'), ('Bar', 'bar\nwith multiline\n')]
        formatted = formatRFC822Headers(HEADERS)

        self.assertEqual(formatted, 'Foo: foo\r\nBar: bar\r\n  with multiline')
예제 #4
0
    def test_formatRFC822Headers_empty(self):
        from Products.CMFDefault.utils import formatRFC822Headers

        HEADERS = [('Foo', 'foo'), ('Bar', '')]
        formatted = formatRFC822Headers(HEADERS)

        self.assertEqual(formatted, 'Foo: foo\r\nBar: ')
예제 #5
0
    def manage_FTPget(self):
        """
          Get the coordinate as text for WebDAV src / FTP download.
      """
        hdrlist = self.getMetadataHeaders()
        hdrtext = formatRFC822Headers(hdrlist)
        bodytext = "%s\n\n%s" % (hdrtext, self.asText())

        return bodytext
예제 #6
0
    def manage_FTPget(self):
        """
          Get the coordinate as text for WebDAV src / FTP download.
      """
        hdrlist = self.getMetadataHeaders()
        hdrtext = formatRFC822Headers(hdrlist)
        bodytext = '%s\n\n%s' % (hdrtext, self.asText())

        return bodytext
예제 #7
0
파일: Link.py 프로젝트: nacho22martin/tesis
    def manage_FTPget(self):
        """
            Get the link as text for WebDAV src / FTP download.
        """
        hdrlist = self.getMetadataHeaders()
        hdrtext = formatRFC822Headers( hdrlist )
        bodytext = '%s\n\n%s' % ( hdrtext, self.getRemoteUrl() )

        return bodytext
예제 #8
0
    def manage_FTPget(self):
        """
            Get the link as text for WebDAV src / FTP download.
        """
        hdrlist = self.getMetadataHeaders()
        hdrtext = formatRFC822Headers( hdrlist )
        bodytext = '%s\n\n%s' % ( hdrtext, self.getRemoteUrl() )

        return bodytext
예제 #9
0
파일: test_utils.py 프로젝트: goschtl/zope
    def test_formatRFC822Headers_empty(self):
        from Products.CMFDefault.utils import formatRFC822Headers

        HEADERS = [ ('Foo', 'foo')
                  , ('Bar', '')
                  ]

        formatted = formatRFC822Headers( HEADERS )

        self.assertEqual( formatted, 'Foo: foo\r\nBar: ' )
예제 #10
0
파일: test_utils.py 프로젝트: goschtl/zope
    def test_formatRFC822Headers_multiline_intermediate_blank_line(self):
        from Products.CMFDefault.utils import formatRFC822Headers

        HEADERS = [ ('Foo', 'foo')
                  , ('Bar', 'bar\n\nwith multiline')
                  ]

        formatted = formatRFC822Headers( HEADERS )

        self.assertEqual( formatted
                        , 'Foo: foo\r\nBar: bar\r\n  \r\n  with multiline' )
예제 #11
0
파일: Document.py 프로젝트: bendavis78/zope
    def manage_FTPget(self):
        "Get the document body for FTP download (also used for the WebDAV SRC)"
        if self.Format() == 'text/html':
            ti = self.getTypeInfo()
            method_id = ti and ti.queryMethodID('gethtml', context=self)
            if method_id:
                method = getattr(self, method_id)
                if getattr(aq_base(method), 'isDocTemp', 0):
                    bodytext = method(self, self.REQUEST)
                else:
                    bodytext = method()
            else:
                # Use the old code as fallback. May be removed some day.
                hdrlist = self.getMetadataHeaders()
                hdrtext = ''
                for name, content in hdrlist:
                    if name.lower() == 'title':
                        continue
                    else:
                        hdrtext = '%s\n <meta name="%s" content="%s" />' % (
                            hdrtext, name, content)

                bodytext = self._htmlsrc % {
                    'title': self.Title(),
                    'metatags': hdrtext,
                    'body': self.EditableBody(),
                }
        else:
            hdrlist = self.getMetadataHeaders()
            hdrtext = formatRFC822Headers(hdrlist)
            normalizer = queryUtility(ILinebreakNormalizer)

            if normalizer is not None:
                text = normalizer.normalizeOutgoing(self, self.text)
            else:
                text = self.text

            bodytext = '%s\r\n\r\n%s' % (hdrtext, text)

        return bodytext
예제 #12
0
파일: Document.py 프로젝트: goschtl/zope
    def manage_FTPget(self):
        "Get the document body for FTP download (also used for the WebDAV SRC)"
        if self.Format() == 'text/html':
            ti = self.getTypeInfo()
            method_id = ti and ti.queryMethodID('gethtml', context=self)
            if method_id:
                method = getattr(self, method_id)
                if getattr(aq_base(method), 'isDocTemp', 0):
                    bodytext = method(self, self.REQUEST)
                else:
                    bodytext = method()
            else:
                # Use the old code as fallback. May be removed some day.
                hdrlist = self.getMetadataHeaders()
                hdrtext = ''
                for name, content in hdrlist:
                    if name.lower() == 'title':
                        continue
                    else:
                        hdrtext = '%s\n <meta name="%s" content="%s" />' % (
                            hdrtext, name, content)

                bodytext = self._htmlsrc % {
                    'title': self.Title(),
                    'metatags': hdrtext,
                    'body': self.EditableBody(),
                    }
        else:
            hdrlist = self.getMetadataHeaders()
            hdrtext = formatRFC822Headers( hdrlist )
            normalizer = queryUtility(ILinebreakNormalizer)
            
            if normalizer is not None:
                text = normalizer.normalizeOutgoing(self, self.text)
            else:
                text = self.text
 
            bodytext = '%s\r\n\r\n%s' % ( hdrtext, text )

        return bodytext