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
135540b4
Commit
135540b4
authored
Apr 02, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More tweaks to the unicode section of the README.
parent
ccee7d9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
README.rst
+19
-18
No files found.
README.rst
View file @
135540b4
...
@@ -83,26 +83,27 @@ Unicode Handling
...
@@ -83,26 +83,27 @@ Unicode Handling
This section describes Pystache's handling of unicode (e.g. strings and
This section describes Pystache's handling of unicode (e.g. strings and
encodings).
encodings).
Internally Pystache uses only unicode strings. For input, Pystache accepts
Internally
,
Pystache uses only unicode strings. For input, Pystache accepts
both ``unicode`` and ``str`` strings. For output, Pystache's template
both ``unicode`` and ``str`` strings. For output, Pystache's template
rendering methods return only unicode.
rendering methods return only unicode.
The Renderer class supports a number of attributes that control how Pystache
Pystache's ``Renderer`` class supports a number of attributes that control how
converts ``str`` strings to unicode on input. These include the
Pystache converts ``str`` strings to unicode on input. These include the
file_encoding, string_encoding, and decode_errors attributes.
``file_encoding``, ``string_encoding``, and ``decode_errors`` attributes.
The file_encoding attribute is the encoding the renderer uses to convert
The ``file_encoding`` attribute is the encoding the renderer uses to convert
any files read from the file system to unicode. Similarly, string_encoding
any files read from the file system to unicode. Similarly, ``string_encoding``
is the encoding the renderer uses to convert any other strings of type str
is the encoding the renderer uses to convert to unicode any other strings of
to unicode (e.g. context values of type ``str``). The decode_errors
type ``str`` encountered during the rendering process (e.g. context values
attribute is what the renderer passes as the ``errors`` argument to
of type ``str``). The ``decode_errors`` attribute is what the renderer
Python's built-in `unicode()`_ function when converting. The valid values
passes as the ``errors`` argument to Python's `built-in unicode function`_
are 'strict', 'ignore', or 'replace'.
``unicode()`` when converting. The valid values for this argument are
``strict``, ``ignore``, and ``replace``.
Each of these attributes can be set via the Renderer class's constructor
using a keyword argument of the same name. In addition, the file_encoding
Each of these attributes can be set via the ``Renderer`` class's constructor
attribute can be controlled on a per-view basis by subclassing the class
using a keyword argument of the same name. In addition, the ``file_encoding``
`TemplateSpec`. When not specified explicitly, these attributes default
attribute can be controlled on a per-view basis by subclassing the
``TemplateSpec`` class. When not specified explicitly, these attributes default
to values set in Pystache's ``defaults`` module.
to values set in Pystache's ``defaults`` module.
...
@@ -169,5 +170,5 @@ Author
...
@@ -169,5 +170,5 @@ Author
.. _PyPI: http://pypi.python.org/pypi/pystache
.. _PyPI: http://pypi.python.org/pypi/pystache
.. _Pystache: https://github.com/defunkt/pystache
.. _Pystache: https://github.com/defunkt/pystache
.. _semantically versioned: http://semver.org
.. _semantically versioned: http://semver.org
.. _
unicode()
: http://docs.python.org/library/functions.html#unicode
.. _
built-in unicode function
: http://docs.python.org/library/functions.html#unicode
.. _version 1.0.3: https://github.com/mustache/spec/tree/48c933b0bb780875acbfd15816297e263c53d6f7
.. _version 1.0.3: https://github.com/mustache/spec/tree/48c933b0bb780875acbfd15816297e263c53d6f7
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