aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/views.py
diff options
context:
space:
mode:
authorTom Christie2013-06-26 14:41:07 -0700
committerTom Christie2013-06-26 14:41:07 -0700
commit35e4d1cf9cdc71d1ac6501feb0337d27a1cf946e (patch)
tree740fd49cbc21b8c84381f77b2340b84588d928bf /rest_framework/tests/views.py
parent69e5e3cc0db481e4fad7ac34bf28b73f4786e790 (diff)
parentc8b0e6c40f6bcf447aa539ff98b9985aa53032ce (diff)
downloaddjango-rest-framework-35e4d1cf9cdc71d1ac6501feb0337d27a1cf946e.tar.bz2
Merge pull request #943 from trwired/utf8safedocs
Make browsable API views play nice with utf-8
Diffstat (limited to 'rest_framework/tests/views.py')
-rw-r--r--rest_framework/tests/views.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/rest_framework/tests/views.py b/rest_framework/tests/views.py
new file mode 100644
index 00000000..fc00cc0b
--- /dev/null
+++ b/rest_framework/tests/views.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+
+from rest_framework.views import APIView
+
+
+# test strings snatched from http://www.columbia.edu/~fdc/utf8/,
+# http://winrus.com/utf8-jap.htm and memory
+UTF8_TEST_DOCSTRING = (
+ 'zażółć gęślą jaźń'
+ 'Sîne klâwen durh die wolken sint geslagen'
+ 'Τη γλώσσα μου έδωσαν ελληνική'
+ 'யாமறிந்த மொழிகளிலே தமிழ்மொழி'
+ 'На берегу пустынных волн'
+ 'てすと'
+ 'アイウエオカキクケコサシスセソタチツテ'
+)
+
+
+# Apparently there is an issue where docstrings of imported view classes
+# do not retain their encoding information even if a module has a proper
+# encoding declaration at the top of its source file. Therefore for tests
+# to catch unicode related errors, a mock view has to be declared in a separate
+# module.
+class ViewWithNonASCIICharactersInDocstring(APIView):
+ __doc__ = UTF8_TEST_DOCSTRING