From casey at zope.com Tue May 4 15:31:21 2004 From: casey at zope.com (Casey Duncan) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils/tests - testTree.py:1.4.44.2 Message-ID: <200405041931.i44JVLW6021364@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/ZTUtils/tests In directory cvs.zope.org:/tmp/cvs-serv21122/lib/python/ZTUtils/tests Modified Files: Tag: Zope-2_7-branch testTree.py Log Message: Make sure encoding of tree state does not include newline characters (issue #122 6) === Zope/lib/python/ZTUtils/tests/testTree.py 1.4.44.1 => 1.4.44.2 === --- Zope/lib/python/ZTUtils/tests/testTree.py:1.4.44.1 Thu Jan 8 18:34:04 2004 +++ Zope/lib/python/ZTUtils/tests/testTree.py Tue May 4 15:31:09 2004 @@ -187,6 +187,7 @@ treeroot1 = self.tm.tree(self.root, self.expansionmap) encoded = Tree.encodeExpansion(treeroot1.flat()) + self.failIf(encoded.find('\n') != -1) decodedmap = Tree.decodeExpansion(encoded) treeroot2 = self.tm.tree(self.root, decodedmap) From casey at zope.com Tue May 4 15:31:40 2004 From: casey at zope.com (Casey Duncan) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Tree.py:1.15.2.5 Message-ID: <200405041931.i44JVeeS021397@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv21122/lib/python/ZTUtils Modified Files: Tag: Zope-2_7-branch Tree.py Log Message: Make sure encoding of tree state does not include newline characters (issue #122 6) === Zope/lib/python/ZTUtils/Tree.py 1.15.2.4 => 1.15.2.5 === --- Zope/lib/python/ZTUtils/Tree.py:1.15.2.4 Thu Jan 8 18:34:03 2004 +++ Zope/lib/python/ZTUtils/Tree.py Tue May 4 15:31:09 2004 @@ -232,7 +232,7 @@ Encoded string use only alpahnumeric characters, and "._-". ''' - return translate(base64.encodestring(str(s)), a2u_map) + return translate(base64.encodestring(str(s)), a2u_map).replace('\n', '') def a2b(s): '''Decode a b2a-encoded string.''' From casey at zope.com Tue May 4 15:33:11 2004 From: casey at zope.com (Casey Duncan) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils/tests - testTree.py:1.6 Message-ID: <200405041933.i44JXBSj022254@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/ZTUtils/tests In directory cvs.zope.org:/tmp/cvs-serv21759/lib/python/ZTUtils/tests Modified Files: testTree.py Log Message: Make sure encoding of tree state does not include newline characters (issue #122 6) === Zope/lib/python/ZTUtils/tests/testTree.py 1.5 => 1.6 === --- Zope/lib/python/ZTUtils/tests/testTree.py:1.5 Thu Jan 15 18:00:17 2004 +++ Zope/lib/python/ZTUtils/tests/testTree.py Tue May 4 15:33:08 2004 @@ -187,6 +187,7 @@ treeroot1 = self.tm.tree(self.root, self.expansionmap) encoded = Tree.encodeExpansion(treeroot1.flat()) + self.failIf(encoded.find('\n') != -1) decodedmap = Tree.decodeExpansion(encoded) treeroot2 = self.tm.tree(self.root, decodedmap) From casey at zope.com Tue May 4 15:33:39 2004 From: casey at zope.com (Casey Duncan) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Tree.py:1.19 Message-ID: <200405041933.i44JXdZh022830@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv21759/lib/python/ZTUtils Modified Files: Tree.py Log Message: Make sure encoding of tree state does not include newline characters (issue #122 6) === Zope/lib/python/ZTUtils/Tree.py 1.18 => 1.19 === --- Zope/lib/python/ZTUtils/Tree.py:1.18 Thu Jan 15 18:00:17 2004 +++ Zope/lib/python/ZTUtils/Tree.py Tue May 4 15:33:07 2004 @@ -232,7 +232,7 @@ Encoded string use only alpahnumeric characters, and "._-". ''' - return translate(base64.encodestring(str(s)), a2u_map) + return translate(base64.encodestring(str(s)), a2u_map).replace('\n', '') def a2b(s): '''Decode a b2a-encoded string.''' From andreas at andreas-jung.com Fri May 28 09:39:10 2004 From: andreas at andreas-jung.com (Andreas Jung) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils/tests - testBatch.py:1.7.66.1 Message-ID: <200405281339.i4SDdAR4030712@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/ZTUtils/tests In directory cvs.zope.org:/tmp/cvs-serv30489/lib/python/ZTUtils/tests Modified Files: Tag: Zope-2_7-branch testBatch.py Log Message: - Collector #1265: Fixed handling of orphans in ZTUtil.Batch === Zope/lib/python/ZTUtils/tests/testBatch.py 1.7 => 1.7.66.1 === --- Zope/lib/python/ZTUtils/tests/testBatch.py:1.7 Wed Aug 14 18:10:12 2002 +++ Zope/lib/python/ZTUtils/tests/testBatch.py Fri May 28 09:39:06 2004 @@ -42,6 +42,12 @@ assert b.sequence_length == 8 assert len(b.next) == 3 + def testLengthEqualsSizePlusOrphans(self): + '''Test limit case where batch length is equal to size + orphans''' + for bsize in (12, 14): + b = Batch(range(bsize), size=10, start=1, end=0, orphan=3, overlap=0) + assert b.length = b.sequence_length + def test_suite(): return makeSuite(BatchTests) From andreas at andreas-jung.com Fri May 28 09:39:37 2004 From: andreas at andreas-jung.com (Andreas Jung) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils - Batch.py:1.10.66.1 Message-ID: <200405281339.i4SDdbCT030755@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/ZTUtils In directory cvs.zope.org:/tmp/cvs-serv30489/lib/python/ZTUtils Modified Files: Tag: Zope-2_7-branch Batch.py Log Message: - Collector #1265: Fixed handling of orphans in ZTUtil.Batch === Zope/lib/python/ZTUtils/Batch.py 1.10 => 1.10.66.1 === --- Zope/lib/python/ZTUtils/Batch.py:1.10 Wed Aug 14 18:10:12 2002 +++ Zope/lib/python/ZTUtils/Batch.py Fri May 28 09:39:05 2004 @@ -106,7 +106,7 @@ if end < start: end=start else: end=start+size-1 - try: sequence[end+orphan-1] + try: sequence[end+orphan] except IndexError: end=len(sequence) elif end > 0: try: sequence[end-1] From andreas at andreas-jung.com Fri May 28 11:00:32 2004 From: andreas at andreas-jung.com (Andreas Jung) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/ZTUtils/tests - testBatch.py:1.7.66.2 Message-ID: <200405281500.i4SF0WHL018732@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/ZTUtils/tests In directory cvs.zope.org:/tmp/cvs-serv18702/lib/python/ZTUtils/tests Modified Files: Tag: Zope-2_7-branch testBatch.py Log Message: improved test for orphan testing === Zope/lib/python/ZTUtils/tests/testBatch.py 1.7.66.1 => 1.7.66.2 === --- Zope/lib/python/ZTUtils/tests/testBatch.py:1.7.66.1 Fri May 28 09:39:06 2004 +++ Zope/lib/python/ZTUtils/tests/testBatch.py Fri May 28 11:00:31 2004 @@ -44,9 +44,9 @@ def testLengthEqualsSizePlusOrphans(self): '''Test limit case where batch length is equal to size + orphans''' - for bsize in (12, 14): + for bsize, length in ((12,11), (13,12), (14,13), (15,10)): b = Batch(range(bsize), size=10, start=1, end=0, orphan=3, overlap=0) - assert b.length = b.sequence_length + assert length == b.length def test_suite(): return makeSuite(BatchTests) From pw_lists at slinkp.com Fri May 28 16:49:22 2004 From: pw_lists at slinkp.com (Paul Winkler) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates/tests - testZopePageTemplate.py:1.1.2.1 Message-ID: <200405282049.i4SKnMRi025484@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates/tests In directory cvs.zope.org:/tmp/cvs-serv25270/tests Added Files: Tag: Zope-2_7-branch testZopePageTemplate.py Log Message: Bugfix for Collector #596, and tests for same. === Added File Zope/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py === """ZopePageTemplate regression tests. Ensures that adding a page template works correctly. Note: Tests require Zope >= 2.7 """ import unittest import Zope from Testing.makerequest import makerequest class ZPTRegressions(unittest.TestCase): def setUp(self): get_transaction().begin() self.app = makerequest(Zope.app()) f = self.app.manage_addProduct['PageTemplates'].manage_addPageTemplate self._addPT = f self.title = 'title of page template' self.text = 'text of page template' def tearDown(self): get_transaction().abort() self.app._p_jar.close() def testAddWithParams(self): pt = self._addPT('pt1', title=self.title, text=self.text) self.assertEqual(pt.title, self.title) self.assertEqual(pt.document_src(), self.text) def testAddWithoutParams(self): pt = self._addPT('pt1') default_text = open(pt._default_content_fn).read() self.assertEqual(pt.title, '') self.assertEqual(pt.document_src(), default_text) def testAddWithRequest(self): """Test manage_add with file""" request = self.app.REQUEST request.form['file'] = DummyFileUpload(filename='some file', data=self.text, content_type='text/html') self._addPT('pt1', REQUEST=request) # no object is returned when REQUEST is passed. pt = self.app.pt1 self.assertEqual(pt.document_src(), self.text) def testAddWithRequestButNoFile(self): """Collector #596: manage_add with text but no file""" request = self.app.REQUEST self._addPT('pt1', text=self.text, REQUEST=request) # no object is returned when REQUEST is passed. pt = self.app.pt1 self.assertEqual(pt.document_src(), self.text) class DummyFileUpload: def __init__(self, data='', filename='', content_type=''): self.data = data self.filename = filename self.headers = {'content_type': content_type} def read(self): return self.data def test_suite(): return unittest.makeSuite(ZPTRegressions) if __name__ == '__main__': unittest.main(defaultTest='test_suite') From pw_lists at slinkp.com Fri May 28 16:49:51 2004 From: pw_lists at slinkp.com (Paul Winkler) Date: Sun Aug 10 17:05:20 2008 Subject: [ZPT-CVS] CVS: Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.44.44.5 Message-ID: <200405282049.i4SKnpN3025496@cvs.zope.org> Update of /cvs-repository/Zope/lib/python/Products/PageTemplates In directory cvs.zope.org:/tmp/cvs-serv25270 Modified Files: Tag: Zope-2_7-branch ZopePageTemplate.py Log Message: Bugfix for Collector #596, and tests for same. === Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.44.44.4 => 1.44.44.5 === --- Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py:1.44.44.4 Tue Oct 21 11:31:40 2003 +++ Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py Fri May 28 16:49:20 2004 @@ -334,11 +334,14 @@ file = REQUEST.form.get('file') headers = getattr(file, 'headers', None) if headers is None or not file.filename: - zpt = ZopePageTemplate(id) + zpt = ZopePageTemplate(id, text) else: zpt = ZopePageTemplate(id, file, headers.get('content_type')) self._setObject(id, zpt) + if title: + ob = getattr(self, id) + ob.pt_setTitle(title) try: u = self.DestinationURL()