-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serve MessageDialogs and exception views as text/html (4.x) (#1082)
* Restore serving MessageDialogs as text/html Now that Zope uses text/plain by default, MessageDialogs were served as text/plain. Keep compatibility by returning a special string with `asHTML` method, that ZPublisher.HTTPResponse.HTTPResponse.setBody understands. MessageDialogs are deprecated and do not integrate well in Zope >= 4 ZMI, but they are used in some old products. * - move tests into separate module * - add fix for exception views * - typo [ci skip] * - typo [ci skip] Co-authored-by: Jens Vagelpohl <jens@plyp.com>
- Loading branch information
1 parent
6c199cd
commit 8d8d51b
Showing
5 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Testing.ZopeTestCase | ||
|
||
|
||
class TestMessageDialog(Testing.ZopeTestCase.ZopeTestCase): | ||
|
||
def test_publish_set_content_type(self): | ||
from App.Dialogs import MessageDialog | ||
|
||
md = MessageDialog( | ||
title='dialog title', | ||
message='dialog message', | ||
action='action' | ||
) | ||
self.assertIn('dialog title', md) | ||
self.assertIn('dialog message', md) | ||
self.assertIn('action', md) | ||
req = self.app.REQUEST | ||
req.RESPONSE.setBody(md) | ||
self.assertIn('text/html', req.RESPONSE.getHeader('Content-Type')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters