diff --git a/bt5/erp5_web/ActionTemplateItem/portal_types/File/web_view.xml b/bt5/erp5_web/ActionTemplateItem/portal_types/File/web_view.xml index 133fd3af4b49a8cce8f6a9058045dc8d5457f370..96b4717c5f28cb912109717702a0e6ca6c205df4 100644 --- a/bt5/erp5_web/ActionTemplateItem/portal_types/File/web_view.xml +++ b/bt5/erp5_web/ActionTemplateItem/portal_types/File/web_view.xml @@ -88,7 +88,7 @@ <dictionary> <item> <key> <string>text</string> </key> - <value> <string>python:object is not None and object.isWebMode() and object.hasData() and not object.isEditableMode()</string> </value> + <value> <string>python:object is not None and object.isWebMode() and not object.isEditableMode()</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_web/ActionTemplateItem/portal_types/Image/web_view.xml b/bt5/erp5_web/ActionTemplateItem/portal_types/Image/web_view.xml index 06bd7e1ff00dd23c1c1dc0bf9fdbd16858aeb4e9..e160bb51e1ac9fd44b26e845ce9df4867529667d 100644 --- a/bt5/erp5_web/ActionTemplateItem/portal_types/Image/web_view.xml +++ b/bt5/erp5_web/ActionTemplateItem/portal_types/Image/web_view.xml @@ -88,7 +88,7 @@ <dictionary> <item> <key> <string>text</string> </key> - <value> <string>python:object is not None and object.isWebMode() and object.hasData() and not object.isEditableMode()</string> </value> + <value> <string>python:object is not None and object.isWebMode() and not object.isEditableMode()</string> </value> </item> </dictionary> </pickle> diff --git a/product/ERP5/tests/testERP5WebWithDms.py b/product/ERP5/tests/testERP5WebWithDms.py index 3a56ec9274759c4550472a1377f5ac30dfb8c0d3..811ca40e50c79f3ecebf1d4dec38f3d8accc2f56 100644 --- a/product/ERP5/tests/testERP5WebWithDms.py +++ b/product/ERP5/tests/testERP5WebWithDms.py @@ -1648,6 +1648,39 @@ return True sorted([i.getUid() for i in img_list]), ) + def test_checkWebSiteFileViewConsistency(self): + """ + Checks that the default view action of a File, viewing from a web site, + is File_viewAsWeb. + (i.e .../document_module/1/ == .../document_module/1/File_viewAsWeb) + """ + web_site = self.setupWebSite() + # check when the file is empty + file_object = self.portal.document_module.newContent(portal_type="File") + file_object.publish() + self.tic() + path = '%s/document_module/%s/' % ( + web_site.absolute_url_path(), + file_object.getId()) + response_a = self.publish(path) + response_b = self.publish(path + "File_viewAsWeb") + self.assertEqual(response_a.getBody(), response_b.getBody()) + + def test_checkWebSiteImageViewConsistency(self): + """ + Checks that the default view action of a Image, viewing from a web site, + is Image_viewAsWeb. + (i.e .../image_module/1/ == .../image_module/1/Image_viewAsWeb) + """ + web_site = self.setupWebSite() + image_object = self.portal.image_module.newContent(portal_type="Image") + image_object.publish() + self.tic() + path = '%s/image_module/%s/' % (web_site.absolute_url_path(), image_object.getId()) + response_a = self.publish(path) + response_b = self.publish(path + "Image_viewAsWeb") + self.assertEqual(response_a.getBody(), response_b.getBody()) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestERP5WebWithDms))