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
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')
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: ')
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
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
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
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: ' )
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' )
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
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