Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
afb12bbe
Commit
afb12bbe
authored
Mar 20, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed custom_template.Locator to custom_template.Loader.
parent
8c2e922c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
pystache/custom_template.py
+4
-2
tests/test_view.py
+5
-4
No files found.
pystache/custom_template.py
View file @
afb12bbe
...
@@ -16,6 +16,8 @@ from .renderer import Renderer
...
@@ -16,6 +16,8 @@ from .renderer import Renderer
class
CustomizedTemplate
(
object
):
class
CustomizedTemplate
(
object
):
"""
"""
A mixin for specifying custom template information.
Subclass this class only if template customizations are needed.
Subclass this class only if template customizations are needed.
The following attributes allow one to customize/override template
The following attributes allow one to customize/override template
...
@@ -117,10 +119,10 @@ class View(CustomizedTemplate):
...
@@ -117,10 +119,10 @@ class View(CustomizedTemplate):
return
renderer
.
render
(
template
,
self
.
context
)
return
renderer
.
render
(
template
,
self
.
context
)
class
Lo
cato
r
(
object
):
class
Lo
ade
r
(
object
):
"""
"""
A class for finding the template associated to a View
instance.
Supports loading the template of a CustomizedTemplate
instance.
"""
"""
...
...
tests/test_view.py
View file @
afb12bbe
...
@@ -15,7 +15,7 @@ from examples.inverted import Inverted, InvertedLists
...
@@ -15,7 +15,7 @@ from examples.inverted import Inverted, InvertedLists
from
pystache
import
Renderer
from
pystache
import
Renderer
from
pystache
import
View
from
pystache
import
View
from
pystache.reader
import
Reader
from
pystache.reader
import
Reader
from
pystache.custom_template
import
Lo
cator
as
ViewLocato
r
from
pystache.custom_template
import
Lo
ade
r
from
.common
import
AssertIsMixin
from
.common
import
AssertIsMixin
from
.common
import
DATA_DIR
from
.common
import
DATA_DIR
from
.data.views
import
SampleView
from
.data.views
import
SampleView
...
@@ -132,16 +132,17 @@ class ViewTestCase(unittest.TestCase):
...
@@ -132,16 +132,17 @@ class ViewTestCase(unittest.TestCase):
self
.
assertEquals
(
view
.
render
(),
"""one, two, three, empty list"""
)
self
.
assertEquals
(
view
.
render
(),
"""one, two, three, empty list"""
)
class
Lo
cato
rTests
(
unittest
.
TestCase
,
AssertIsMixin
):
class
Lo
ade
rTests
(
unittest
.
TestCase
,
AssertIsMixin
):
# TODO: rename this method to _make_loader().
def
_make_locator
(
self
):
def
_make_locator
(
self
):
locator
=
ViewLocato
r
(
search_dirs
=
[
DATA_DIR
])
locator
=
Loade
r
(
search_dirs
=
[
DATA_DIR
])
return
locator
return
locator
# TODO: fully test constructor.
# TODO: fully test constructor.
def
test_init__reader
(
self
):
def
test_init__reader
(
self
):
reader
=
"reader"
# in practice, this is a reader instance.
reader
=
"reader"
# in practice, this is a reader instance.
locator
=
ViewLocato
r
(
search_dirs
=
None
,
template_locator
=
None
,
reader
=
reader
)
locator
=
Loade
r
(
search_dirs
=
None
,
template_locator
=
None
,
reader
=
reader
)
self
.
assertIs
(
locator
.
reader
,
reader
)
self
.
assertIs
(
locator
.
reader
,
reader
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment