Commit 65e347a9 by Chris Jerdonek

Renamed template.py to renderer.py.

parent b6018af6
...@@ -20,7 +20,7 @@ import sys ...@@ -20,7 +20,7 @@ import sys
# ValueError: Attempted relative import in non-package # ValueError: Attempted relative import in non-package
# #
from pystache.loader import Loader from pystache.loader import Loader
from pystache.template import Template from pystache.renderer import Template
USAGE = """\ USAGE = """\
......
...@@ -5,7 +5,7 @@ This module contains the initialization logic called by __init__.py. ...@@ -5,7 +5,7 @@ This module contains the initialization logic called by __init__.py.
""" """
from .template import Template from .renderer import Template
from .view import View from .view import View
from .loader import Loader from .loader import Loader
......
...@@ -10,7 +10,7 @@ from types import UnboundMethodType ...@@ -10,7 +10,7 @@ from types import UnboundMethodType
from .context import Context from .context import Context
from .loader import Loader from .loader import Loader
from .template import Template from .renderer import Template
class View(object): class View(object):
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import unittest import unittest
import pystache import pystache
from pystache import template from pystache import renderer
class PystacheTests(object): class PystacheTests(object):
...@@ -114,16 +114,16 @@ class PystacheWithoutMarkupsafeTests(PystacheTests, unittest.TestCase): ...@@ -114,16 +114,16 @@ class PystacheWithoutMarkupsafeTests(PystacheTests, unittest.TestCase):
"""Test pystache without markupsafe enabled.""" """Test pystache without markupsafe enabled."""
def setUp(self): def setUp(self):
self.original_markupsafe = template.markupsafe self.original_markupsafe = renderer.markupsafe
template.markupsafe = None renderer.markupsafe = None
def tearDown(self): def tearDown(self):
template.markupsafe = self.original_markupsafe renderer.markupsafe = self.original_markupsafe
# If markupsafe is available, then run the same tests again but without # If markupsafe is available, then run the same tests again but without
# disabling markupsafe. # disabling markupsafe.
_BaseClass = unittest.TestCase if template.markupsafe else object _BaseClass = unittest.TestCase if renderer.markupsafe else object
class PystacheWithMarkupsafeTests(PystacheTests, _BaseClass): class PystacheWithMarkupsafeTests(PystacheTests, _BaseClass):
"""Test pystache with markupsafe enabled.""" """Test pystache with markupsafe enabled."""
...@@ -132,5 +132,5 @@ class PystacheWithMarkupsafeTests(PystacheTests, _BaseClass): ...@@ -132,5 +132,5 @@ class PystacheWithMarkupsafeTests(PystacheTests, _BaseClass):
non_strings_expected = """(123 & ['something'])(chris & 0.9)""" non_strings_expected = """(123 & ['something'])(chris & 0.9)"""
def test_markupsafe_available(self): def test_markupsafe_available(self):
self.assertTrue(template.markupsafe, "markupsafe isn't available. " self.assertTrue(renderer.markupsafe, "markupsafe isn't available. "
"The with-markupsafe tests shouldn't be running.") "The with-markupsafe tests shouldn't be running.")
...@@ -9,8 +9,8 @@ import codecs ...@@ -9,8 +9,8 @@ import codecs
import sys import sys
import unittest import unittest
from pystache import template from pystache import renderer
from pystache.template import Template from pystache.renderer import Template
class TemplateTestCase(unittest.TestCase): class TemplateTestCase(unittest.TestCase):
...@@ -22,8 +22,8 @@ class TemplateTestCase(unittest.TestCase): ...@@ -22,8 +22,8 @@ class TemplateTestCase(unittest.TestCase):
Disable markupsafe. Disable markupsafe.
""" """
self.original_markupsafe = template.markupsafe self.original_markupsafe = renderer.markupsafe
template.markupsafe = None renderer.markupsafe = None
def tearDown(self): def tearDown(self):
self._restore_markupsafe() self._restore_markupsafe()
...@@ -36,7 +36,7 @@ class TemplateTestCase(unittest.TestCase): ...@@ -36,7 +36,7 @@ class TemplateTestCase(unittest.TestCase):
Restore markupsafe to its original state. Restore markupsafe to its original state.
""" """
template.markupsafe = self.original_markupsafe renderer.markupsafe = self.original_markupsafe
def test__was_markupsafe_imported(self): def test__was_markupsafe_imported(self):
""" """
...@@ -141,7 +141,7 @@ class TemplateTestCase(unittest.TestCase): ...@@ -141,7 +141,7 @@ class TemplateTestCase(unittest.TestCase):
# Check the standard case. # Check the standard case.
actual = _template.literal("abc") actual = _template.literal("abc")
self.assertEquals(actual, "abc") self.assertEquals(actual, "abc")
self.assertEquals(type(actual), template.markupsafe.Markup) self.assertEquals(type(actual), renderer.markupsafe.Markup)
s = "é" s = "é"
# Check that markupsafe respects default_encoding. # Check that markupsafe respects default_encoding.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment