Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: third_party/markupsafe/_native.py

Issue 23445019: Add MarkupSafe library to third_party (dependency for Jinja2 2.7) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/markupsafe/_constants.py ('k') | third_party/markupsafe/_speedups.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/markupsafe/_native.py
diff --git a/third_party/jinja2/_markupsafe/_native.py b/third_party/markupsafe/_native.py
similarity index 86%
copy from third_party/jinja2/_markupsafe/_native.py
copy to third_party/markupsafe/_native.py
index 7b95828ec87f7e7e2c8af4e5ce343eedbe3fa038..5e83f10a117c4717975327337ef43d0a14a91e96 100644
--- a/third_party/jinja2/_markupsafe/_native.py
+++ b/third_party/markupsafe/_native.py
@@ -8,7 +8,8 @@
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
-from jinja2._markupsafe import Markup
+from markupsafe import Markup
+from markupsafe._compat import text_type
def escape(s):
@@ -18,7 +19,7 @@ def escape(s):
"""
if hasattr(s, '__html__'):
return s.__html__()
- return Markup(unicode(s)
+ return Markup(text_type(s)
.replace('&', '&')
.replace('>', '>')
.replace('<', '&lt;')
@@ -40,6 +41,6 @@ def soft_unicode(s):
"""Make a string unicode if it isn't already. That way a markup
string is not converted back to unicode.
"""
- if not isinstance(s, unicode):
- s = unicode(s)
+ if not isinstance(s, text_type):
+ s = text_type(s)
return s
« no previous file with comments | « third_party/markupsafe/_constants.py ('k') | third_party/markupsafe/_speedups.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698