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
f6b36707
Commit
f6b36707
authored
Mar 31, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored loader.Loader to use a _make_locator() method.
parent
0acab11d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
pystache/loader.py
+7
-4
No files found.
pystache/loader.py
View file @
f6b36707
...
...
@@ -51,8 +51,8 @@ class Loader(object):
It should accept a string of type str and an optional encoding
name and return a string of type unicode. Defaults to calling
Python's built-in function unicode() using the package
encod
ing
and decode-
errors defaults.
Python's built-in function unicode() using the package
str
ing
encoding and decode
errors defaults.
"""
if
extension
is
None
:
...
...
@@ -68,6 +68,9 @@ class Loader(object):
self
.
file_encoding
=
file_encoding
self
.
to_unicode
=
to_unicode
def
_make_locator
(
self
):
return
Locator
(
extension
=
self
.
extension
)
def
unicode
(
self
,
s
,
encoding
=
None
):
"""
Convert a string to unicode using the given encoding, and return it.
...
...
@@ -116,7 +119,7 @@ class Loader(object):
search_dirs: the list of directories in which to search.
"""
locator
=
Locator
(
extension
=
self
.
extension
)
locator
=
self
.
_make_locator
(
)
path
=
locator
.
find_path_by_name
(
search_dirs
,
name
)
...
...
@@ -134,7 +137,7 @@ class Loader(object):
search_dirs: the list of directories in which to search.
"""
locator
=
Locator
(
extension
=
self
.
extension
)
locator
=
self
.
_make_locator
(
)
path
=
locator
.
find_path_by_object
(
search_dirs
,
obj
)
...
...
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