diff --git a/bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py b/bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py index fab263112dfbc472f38a00b6addc00b709f91ea4..2420bddc271633cb561e0f9a1ee447970e0d32f4 100644 --- a/bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py +++ b/bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py @@ -224,7 +224,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): file_path = os.path.join(cfg.instancehome, 'tests', test_title+'.py') if os.path.exists(file_path): os.remove(file_path) - f = file(file_path, 'w') + f = open(file_path, 'w') f.write(test_data) f.close() self.assertTrue(os.path.exists(file_path)) @@ -2371,7 +2371,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): file_path = os.path.join(cfg.instancehome, 'PropertySheet', ps_title+'.py') if os.path.exists(file_path): os.remove(file_path) - f = file(file_path, 'w') + f = open(file_path, 'w') f.write(ps_data) f.close() self.assertTrue(os.path.exists(file_path)) @@ -2463,7 +2463,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor): file_path = os.path.join(cfg.instancehome, 'PropertySheet', ps_title+'.py') if os.path.exists(file_path): os.remove(file_path) - f = file(file_path, 'w') + f = open(file_path, 'w') f.write(ps_data) f.close() self.assertTrue(os.path.exists(file_path)) @@ -8036,7 +8036,7 @@ class _LocalTemplateItemMixin: file_path = os.path.join(self.document_base_path, self.document_title+'.py') if os.path.exists(file_path): os.remove(file_path) - f = file(file_path, 'w') + f = open(file_path, 'w') f.write(self.document_data) f.close() self.assertTrue(os.path.exists(file_path)) @@ -8048,7 +8048,7 @@ class _LocalTemplateItemMixin: file_path = os.path.join(self.document_base_path, self.document_title+'.py') if os.path.exists(file_path): os.remove(file_path) - f = file(file_path, 'w') + f = open(file_path, 'w') f.write(self.document_data_updated) f.close() self.assertTrue(os.path.exists(file_path)) @@ -8070,12 +8070,12 @@ class _LocalTemplateItemMixin: def stepCheckDocumentExists(self, sequence=None, **kw): self.assertFalse(not os.path.exists(sequence['document_path'])) - self.assertEqual(file(sequence['document_path']).read(), + self.assertEqual(open(sequence['document_path']).read(), sequence['document_data']) def stepCheckUpdatedDocumentExists(self, sequence=None, **kw): self.assertFalse(not os.path.exists(sequence['document_path'])) - self.assertEqual(file(sequence['document_path']).read(), + self.assertEqual(open(sequence['document_path']).read(), sequence['document_data_updated']) def stepCheckDocumentRemoved(self, sequence=None, **kw): diff --git a/bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py b/bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py index f8ebe0fd1ea78102358fd77c8e395394e5dc52c1..b031dad119ea0f1e573242de84cd65c7a84e81b4 100644 --- a/bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py +++ b/bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testCRM.py @@ -693,7 +693,7 @@ class TestCRMMailIngestion(BaseTestCRM): def _readTestData(self, filename): """read test data from data directory.""" - return file(makeFilePath(filename)).read() + return open(makeFilePath(filename)).read() def _ingestMail(self, filename=None, data=None): """ingest an email from the mail in data dir named `filename`""" diff --git a/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py b/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py index 4362ad7df39a8bbe2a937ed586780c2a6357bfe8..b47e877c398c849c4c6d103138a6bc8839dc3bc5 100644 --- a/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py +++ b/bt5/erp5_syncml/ModuleComponentTemplateItem/portal_components/module.erp5.SyncMLTransportFile.py @@ -32,7 +32,7 @@ class FileTransport: def send(self, to_url, data, sync_id, content_type): filename = to_url[len('file:/'):] try: - stream = file(filename, 'w') + stream = open(filename, 'w') stream.write(data) stream.close() except IOError: diff --git a/bt5/erp5_syncml/ToolComponentTemplateItem/portal_components/tool.erp5.SynchronizationTool.py b/bt5/erp5_syncml/ToolComponentTemplateItem/portal_components/tool.erp5.SynchronizationTool.py index 57650feb33148e4de74504d4b9cae2ea02abf7b4..bb8c684547b0c4fa34fbddf103b61fa19fda31c3 100644 --- a/bt5/erp5_syncml/ToolComponentTemplateItem/portal_components/tool.erp5.SynchronizationTool.py +++ b/bt5/erp5_syncml/ToolComponentTemplateItem/portal_components/tool.erp5.SynchronizationTool.py @@ -262,7 +262,7 @@ class SynchronizationTool(BaseTool): filename = from_url[len('file:'):] xml = None try: - stream = file(filename, 'r') + stream = open(filename, 'r') except IOError: # XXX-Aurel : Why raising here make unit tests to fail ? # raise ValueError("Impossible to read file %s, error is %s" diff --git a/product/ERP5/tests/extractMessageCatalog.py b/product/ERP5/tests/extractMessageCatalog.py index f812fc685648c46524d60a2d8de51942b873fe71..56a315780a059b2742ece9f5a069d599815a1040 100644 --- a/product/ERP5/tests/extractMessageCatalog.py +++ b/product/ERP5/tests/extractMessageCatalog.py @@ -63,7 +63,7 @@ class ExtractMessageCatalog(TestXHTML): messages = dict(getattr(self.portal.Localizer, i)._messages) result[i].update(messages) - f = file('%s.pot' % i, 'w') + f = open('%s.pot' % i, 'w') for msgid in result[i].keys(): f.write('msgid "%s"\nmsgstr ""\n\n' % msgid) diff --git a/product/ERP5/tests/utils.py b/product/ERP5/tests/utils.py index 8aed6f56c36b4a510ab7d23c388cbbd55e09590b..8f9c493a3c704c78eed4b538af7a02d1e1a01b3a 100644 --- a/product/ERP5/tests/utils.py +++ b/product/ERP5/tests/utils.py @@ -186,4 +186,4 @@ class BusinessTemplateInfoDir(BusinessTemplateInfoBase): return fileinfo def readFileInfo(self, fileinfo): - return file(fileinfo).read() + return open(fileinfo).read() diff --git a/product/ERP5Type/patches/DA.py b/product/ERP5Type/patches/DA.py index 17a9db78085d4129a42df06a76265114ffa96c0e..c1d101564671fdccefc35d799fea5ff425ee2fd5 100644 --- a/product/ERP5Type/patches/DA.py +++ b/product/ERP5Type/patches/DA.py @@ -36,7 +36,7 @@ def DA_fromFile(self, filename): """ Read the file and update self """ - f = file(filename) + f = open(filename) s = f.read() f.close() self.fromText(s)