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
5628dadd
Commit
5628dadd
authored
Mar 22, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed Loader.template_locator to Loader.locator.
parent
dcb78dd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
pystache/custom_template.py
+5
-6
tests/test_custom_template.py
+3
-3
No files found.
pystache/custom_template.py
View file @
5628dadd
...
...
@@ -135,8 +135,7 @@ class Loader(object):
self
.
reader
=
reader
self
.
search_dirs
=
search_dirs
# TODO: rename this to locator.
self
.
template_locator
=
locator
self
.
locator
=
locator
# TODO: make this private.
def
get_relative_template_location
(
self
,
view
):
...
...
@@ -152,9 +151,9 @@ class Loader(object):
# Otherwise, we don't know the directory.
template_name
=
(
view
.
template_name
if
view
.
template_name
is
not
None
else
self
.
template_
locator
.
make_template_name
(
view
))
self
.
locator
.
make_template_name
(
view
))
file_name
=
self
.
template_
locator
.
make_file_name
(
template_name
,
view
.
template_extension
)
file_name
=
self
.
locator
.
make_file_name
(
template_name
,
view
.
template_extension
)
return
(
template_dir
,
file_name
)
...
...
@@ -168,9 +167,9 @@ class Loader(object):
if
dir_path
is
None
:
# Then we need to search for the path.
path
=
self
.
template_
locator
.
find_path_by_object
(
self
.
search_dirs
,
view
,
file_name
=
file_name
)
path
=
self
.
locator
.
find_path_by_object
(
self
.
search_dirs
,
view
,
file_name
=
file_name
)
else
:
obj_dir
=
self
.
template_
locator
.
get_object_directory
(
view
)
obj_dir
=
self
.
locator
.
get_object_directory
(
view
)
path
=
os
.
path
.
join
(
obj_dir
,
dir_path
,
file_name
)
return
path
...
...
tests/test_custom_template.py
View file @
5628dadd
...
...
@@ -159,8 +159,8 @@ class LoaderTests(unittest.TestCase, AssertIsMixin):
self
.
assertEquals
(
reader
.
decode_errors
,
'strict'
)
self
.
assertEquals
(
reader
.
encoding
,
sys
.
getdefaultencoding
())
# Check the
template_
locator attribute.
locator
=
loader
.
template_
locator
# Check the locator attribute.
locator
=
loader
.
locator
self
.
assertEquals
(
locator
.
template_extension
,
'mustache'
)
def
test_init__search_dirs
(
self
):
...
...
@@ -179,7 +179,7 @@ class LoaderTests(unittest.TestCase, AssertIsMixin):
locator
=
Locator
()
loader
=
Loader
([],
locator
=
locator
)
self
.
assertIs
(
loader
.
template_
locator
,
locator
)
self
.
assertIs
(
loader
.
locator
,
locator
)
def
test_get_relative_template_location
(
self
):
"""
...
...
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