Skip to content
Browse files

Fix and test FLATPAGES_HTML_RENDERER as a string to import.

  • Loading branch information...
1 parent cdd5d96 commit 5e9722363b7fd3053e0e0eaab725ab9ba1e848b6 @SimonSapin committed
Showing with 8 additions and 7 deletions.
  1. +1 −1 flaskext/flatpages.py
  2. +7 −6 test_flatpages/__init__.py
View
2 flaskext/flatpages.py
@@ -216,7 +216,7 @@ def _parse(self, string, path):
html_renderer = self.app.config['FLATPAGES_HTML_RENDERER']
if not callable(html_renderer):
- html_renderer = import_string(html_renderer)
+ html_renderer = werkzeug.import_string(html_renderer)
return Page(path, meta, content, html_renderer)
View
13 test_flatpages/__init__.py
@@ -145,12 +145,13 @@ def test_other_encoding(self):
self._unicode(pages)
def test_other_html_renderer(self):
- pages = FlatPages(Flask(__name__))
- pages.app.config['FLATPAGES_HTML_RENDERER'] = unicode.upper
- hello = pages.get('hello')
- self.assertEquals(hello.body, u'Hello, *世界*!\n')
- # Markdow
- self.assertEquals(hello.html, u'HELLO, *世界*!\n')
+ for renderer in (unicode.upper, 'string.upper'):
+ pages = FlatPages(Flask(__name__))
+ pages.app.config['FLATPAGES_HTML_RENDERER'] = renderer
+ hello = pages.get('hello')
+ self.assertEquals(hello.body, u'Hello, *世界*!\n')
+ # Upper-case, markdown not interpreted
+ self.assertEquals(hello.html, u'HELLO, *世界*!\n')
def test_other_extension(self):
app = Flask(__name__)

0 comments on commit 5e97223

Please sign in to comment.
Something went wrong with that request. Please try again.