Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.

Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
  • Loading branch information...
commit 4a103086d5c67fa4fcc53c106c9fdf644c742dd8 1 parent 706fd9a
@claudep claudep authored
Showing with 5,334 additions and 4,985 deletions.
  1. +74 −72 django/conf/locale/__init__.py
  2. +2 −1  django/conf/locale/bg/formats.py
  3. +2 −1  django/conf/locale/cs/formats.py
  4. +2 −2 django/conf/locale/en/formats.py
  5. +2 −1  django/conf/locale/es_MX/formats.py
  6. +2 −1  django/conf/locale/et/formats.py
  7. +2 −1  django/conf/locale/fi/formats.py
  8. +2 −1  django/conf/locale/fr/formats.py
  9. +1 −0  django/conf/locale/he/formats.py
  10. +2 −1  django/conf/locale/hu/formats.py
  11. +1 −0  django/conf/locale/ja/formats.py
  12. +1 −0  django/conf/locale/km/formats.py
  13. +1 −0  django/conf/locale/ko/formats.py
  14. +2 −1  django/conf/locale/lv/formats.py
  15. +2 −1  django/conf/locale/nb/formats.py
  16. +2 −1  django/conf/locale/nn/formats.py
  17. +2 −1  django/conf/locale/pl/formats.py
  18. +1 −0  django/conf/locale/pt_BR/formats.py
  19. +2 −1  django/conf/locale/ru/formats.py
  20. +2 −1  django/conf/locale/sk/formats.py
  21. +2 −1  django/conf/locale/sv/formats.py
  22. +3 −1 django/conf/locale/uk/formats.py
  23. +1 −0  django/conf/locale/vi/formats.py
  24. +3 −2 django/contrib/admin/forms.py
  25. +10 −8 django/contrib/admin/helpers.py
  26. +3 −1 django/contrib/admin/models.py
  27. +10 −8 django/contrib/admin/templatetags/admin_list.py
  28. +4 −2 django/contrib/admin/util.py
  29. +19 −17 django/contrib/admin/widgets.py
  30. +4 −4 django/contrib/admindocs/tests/__init__.py
  31. +3 −1 django/contrib/auth/backends.py
  32. +2 −0  django/contrib/auth/hashers.py
  33. +5 −3 django/contrib/auth/management/__init__.py
  34. +4 −2 django/contrib/auth/models.py
  35. +6 −4 django/contrib/auth/tests/auth_backends.py
  36. +4 −2 django/contrib/auth/tests/forms.py
  37. +10 −8 django/contrib/auth/tests/hashers.py
  38. +5 −3 django/contrib/auth/tests/management.py
  39. +4 −2 django/contrib/comments/admin.py
  40. +2 −1  django/contrib/contenttypes/generic.py
  41. +3 −1 django/contrib/contenttypes/tests.py
  42. +4 −2 django/contrib/contenttypes/views.py
  43. +6 −5 django/contrib/databrowse/datastructures.py
  44. +6 −4 django/contrib/databrowse/plugins/calendars.py
  45. +6 −4 django/contrib/databrowse/plugins/fieldchoices.py
  46. +3 −1 django/contrib/databrowse/sites.py
  47. +3 −1 django/contrib/flatpages/models.py
  48. +4 −2 django/contrib/flatpages/tests/forms.py
  49. +30 −28 django/contrib/formtools/tests/__init__.py
  50. +6 −4 django/contrib/formtools/tests/wizard/forms.py
  51. +13 −11 django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
  52. +14 −12 django/contrib/formtools/tests/wizard/wizardtests/tests.py
  53. +12 −10 django/contrib/gis/feeds.py
  54. +6 −4 django/contrib/gis/forms/fields.py
  55. +1 −1  django/contrib/gis/gdal/tests/test_envelope.py
  56. +5 −3 django/contrib/gis/geoip/tests.py
  57. +5 −3 django/contrib/gis/sitemaps/views.py
  58. +3 −3 django/contrib/gis/tests/geoapp/test_feeds.py
  59. +5 −5 django/contrib/gis/tests/geoapp/test_sitemaps.py
  60. +4 −2 django/contrib/gis/views.py
  61. +14 −13 django/contrib/humanize/templatetags/humanize.py
  62. +6 −5 django/contrib/humanize/tests.py
  63. +25 −24 django/contrib/localflavor/ar/ar_provinces.py
  64. +6 −6 django/contrib/localflavor/ar/forms.py
  65. +4 −4 django/contrib/localflavor/at/forms.py
  66. +4 −4 django/contrib/localflavor/au/forms.py
  67. +12 −11 django/contrib/localflavor/br/br_states.py
  68. +8 −8 django/contrib/localflavor/br/forms.py
  69. +11 −11 django/contrib/localflavor/ca/forms.py
  70. +5 −5 django/contrib/localflavor/ch/forms.py
  71. +16 −15 django/contrib/localflavor/cl/cl_regions.py
  72. +5 −5 django/contrib/localflavor/cl/forms.py
  73. +35 −35 django/contrib/localflavor/cn/cn_provinces.py
  74. +10 −10 django/contrib/localflavor/cn/forms.py
  75. +34 −33 django/contrib/localflavor/co/co_departments.py
  76. +10 −10 django/contrib/localflavor/cz/forms.py
  77. +4 −4 django/contrib/localflavor/de/forms.py
  78. +3 −1 django/contrib/localflavor/de_CH/formats.py
  79. +25 −24 django/contrib/localflavor/ec/ec_provinces.py
  80. +2 −2 django/contrib/localflavor/es/forms.py
  81. +345 −343 django/contrib/localflavor/fi/fi_municipalities.py
  82. +3 −3 django/contrib/localflavor/fi/forms.py
  83. +3 −3 django/contrib/localflavor/fr/forms.py
  84. +110 −109 django/contrib/localflavor/fr/fr_department.py
  85. +3 −3 django/contrib/localflavor/gb/forms.py
  86. +3 −3 django/contrib/localflavor/hk/forms.py
  87. +11 −11 django/contrib/localflavor/hr/forms.py
  88. +28 −26 django/contrib/localflavor/hr/hr_choices.py
  89. +6 −6 django/contrib/localflavor/id/forms.py
  90. +4 −3 django/contrib/localflavor/il/forms.py
  91. +7 −7 django/contrib/localflavor/in_/forms.py
  92. +4 −4 django/contrib/localflavor/is_/forms.py
  93. +148 −147 django/contrib/localflavor/is_/is_postalcodes.py
  94. +6 −6 django/contrib/localflavor/it/forms.py
  95. +2 −1  django/contrib/localflavor/it/it_province.py
  96. +2 −1  django/contrib/localflavor/it/it_region.py
  97. +2 −2 django/contrib/localflavor/it/util.py
  98. +3 −1 django/contrib/localflavor/kw/forms.py
  99. +7 −7 django/contrib/localflavor/mk/forms.py
  100. +86 −84 django/contrib/localflavor/mk/mk_choices.py
  101. +31 −30 django/contrib/localflavor/mx/forms.py
  102. +33 −32 django/contrib/localflavor/mx/mx_states.py
  103. +5 −5 django/contrib/localflavor/nl/forms.py
  104. +3 −3 django/contrib/localflavor/no/forms.py
  105. +22 −21 django/contrib/localflavor/no/no_municipalities.py
  106. +3 −3 django/contrib/localflavor/pe/forms.py
  107. +26 −25 django/contrib/localflavor/pe/pe_region.py
  108. +18 −18 django/contrib/localflavor/pl/forms.py
  109. +377 −376 django/contrib/localflavor/pl/pl_administrativeunits.py
  110. +5 −3 django/contrib/localflavor/pt/forms.py
  111. +37 −36 django/contrib/localflavor/py/py_department.py
  112. +7 −7 django/contrib/localflavor/ro/forms.py
  113. +43 −42 django/contrib/localflavor/ro/ro_counties.py
  114. +4 −4 django/contrib/localflavor/ru/forms.py
  115. +3 −3 django/contrib/localflavor/se/forms.py
  116. +22 −21 django/contrib/localflavor/se/se_counties.py
  117. +9 −9 django/contrib/localflavor/si/forms.py
  118. +464 −463 django/contrib/localflavor/si/si_postalcodes.py
  119. +2 −2 django/contrib/localflavor/sk/forms.py
  120. +9 −9 django/contrib/localflavor/tr/forms.py
  121. +6 −6 django/contrib/localflavor/us/forms.py
  122. +2 −2 django/contrib/localflavor/uy/forms.py
  123. +20 −19 django/contrib/localflavor/uy/uy_departaments.py
  124. +4 −3 django/contrib/localflavor/za/forms.py
  125. +3 −1 django/contrib/messages/storage/base.py
  126. +6 −4 django/contrib/sitemaps/tests/flatpages.py
  127. +3 −1 django/contrib/sitemaps/tests/http.py
  128. +5 −3 django/contrib/sites/tests.py
  129. +16 −14 django/contrib/staticfiles/management/commands/collectstatic.py
  130. +5 −3 django/contrib/staticfiles/management/commands/findstatic.py
  131. +6 −5 django/contrib/staticfiles/storage.py
  132. +3 −1 django/contrib/syndication/views.py
  133. +7 −5 django/contrib/webdesign/lorem_ipsum.py
  134. +3 −1 django/contrib/webdesign/templatetags/webdesign.py
  135. +3 −2 django/contrib/webdesign/tests.py
  136. +2 −1  django/core/context_processors.py
  137. +3 −1 django/core/files/base.py
  138. +4 −2 django/core/files/uploadhandler.py
  139. +5 −3 django/core/handlers/base.py
  140. +7 −5 django/core/handlers/wsgi.py
  141. +3 −2 django/core/mail/__init__.py
  142. +5 −3 django/core/mail/message.py
  143. +3 −1 django/core/management/commands/createcachetable.py
  144. +4 −1 django/core/management/commands/loaddata.py
  145. +3 −1 django/core/management/commands/sql.py
  146. +3 −1 django/core/management/commands/sqlall.py
  147. +3 −1 django/core/management/commands/sqlclear.py
  148. +3 −1 django/core/management/commands/sqlcustom.py
  149. +3 −1 django/core/management/commands/sqlflush.py
  150. +3 −1 django/core/management/commands/sqlindexes.py
  151. +3 −1 django/core/management/commands/sqlsequencereset.py
  152. +4 −2 django/core/management/sql.py
  153. +2 −1  django/core/management/validation.py
  154. +4 −1 django/core/serializers/json.py
  155. +2 −1  django/core/serializers/python.py
  156. +3 −1 django/core/serializers/xml_serializer.py
  157. +5 −4 django/core/urlresolvers.py
  158. +17 −15 django/core/validators.py
  159. +3 −2 django/db/backends/mysql/base.py
  160. +5 −5 django/db/backends/oracle/base.py
  161. +3 −1 django/db/backends/postgresql_psycopg2/introspection.py
  162. +8 −6 django/db/backends/postgresql_psycopg2/operations.py
  163. +4 −3 django/db/backends/sqlite3/base.py
  164. +4 −2 django/db/backends/util.py
  165. +5 −3 django/db/models/base.py
  166. +31 −29 django/db/models/fields/__init__.py
  167. +1 −1  django/db/models/fields/files.py
  168. +2 −1  django/forms/extras/widgets.py
  169. +36 −36 django/forms/fields.py
  170. +18 −18 django/forms/forms.py
  171. +11 −11 django/forms/formsets.py
  172. +10 −10 django/forms/models.py
  173. +12 −10 django/forms/util.py
  174. +45 −45 django/forms/widgets.py
  175. +5 −3 django/http/__init__.py
  176. +10 −4 django/http/multipartparser.py
  177. +4 −4 django/template/base.py
  178. +41 −40 django/template/defaultfilters.py
  179. +8 −7 django/template/defaulttags.py
  180. +4 −2 django/templatetags/cache.py
  181. +5 −4 django/templatetags/i18n.py
  182. +1 −1  django/test/client.py
  183. +11 −8 django/test/html.py
  184. +25 −27 django/test/testcases.py
  185. +2 −0  django/test/utils.py
  186. +4 −2 django/utils/crypto.py
  187. +19 −18 django/utils/dateformat.py
  188. +4 −2 django/utils/encoding.py
  189. +81 −80 django/utils/feedgenerator.py
  190. +22 −20 django/utils/html.py
  191. +17 −16 django/utils/regex_helper.py
  192. +24 −22 django/utils/text.py
  193. +3 −1 django/utils/timesince.py
  194. +3 −1 django/utils/translation/__init__.py
  195. +23 −20 django/utils/translation/trans_real.py
  196. +3 −1 django/utils/tzinfo.py
  197. +2 −0  django/utils/version.py
  198. +4 −2 django/views/debug.py
  199. +5 −3 django/views/generic/base.py
  200. +11 −9 django/views/generic/dates.py
  201. +8 −6 django/views/generic/detail.py
  202. +6 −4 django/views/generic/list.py
  203. +4 −3 django/views/static.py
  204. +8 −6 docs/conf.py
  205. +2 −1  docs/ref/files/file.txt
  206. +0 −2  docs/ref/forms/fields.txt
  207. +2 −2 docs/ref/forms/validation.txt
  208. +35 −9 docs/ref/unicode.txt
  209. +8 −8 docs/topics/db/models.txt
  210. +2 −2 docs/topics/i18n/translation.txt
  211. +50 −50 tests/modeltests/aggregation/tests.py
  212. +7 −7 tests/modeltests/basic/tests.py
  213. +3 −1 tests/modeltests/custom_columns/models.py
  214. +3 −1 tests/modeltests/custom_managers/models.py
  215. +2 −2 tests/modeltests/custom_pk/models.py
  216. +2 −2 tests/modeltests/custom_pk/tests.py
  217. +3 −1 tests/modeltests/distinct_on_fields/models.py
  218. +3 −1 tests/modeltests/distinct_on_fields/tests.py
  219. +2 −1  tests/modeltests/expressions/models.py
  220. +10 −10 tests/modeltests/expressions/tests.py
  221. +3 −1 tests/modeltests/field_subclassing/fields.py
  222. +13 −13 tests/modeltests/files/tests.py
  223. +14 −12 tests/modeltests/fixtures_model_package/tests.py
  224. +3 −1 tests/modeltests/generic_relations/models.py
  225. +26 −26 tests/modeltests/generic_relations/tests.py
  226. +3 −1 tests/modeltests/get_or_create/models.py
  227. +5 −3 tests/modeltests/invalid_models/invalid_models/models.py
  228. +4 −2 tests/modeltests/lookup/models.py
  229. +22 −22 tests/modeltests/lookup/tests.py
  230. +2 −1  tests/modeltests/m2m_and_m2o/models.py
  231. +3 −2 tests/modeltests/m2m_intermediary/models.py
  232. +1 −1  tests/modeltests/m2m_through/tests.py
  233. +2 −1  tests/modeltests/many_to_one/models.py
  234. +3 −3 tests/modeltests/many_to_one/tests.py
  235. +2 −1  tests/modeltests/model_forms/models.py
  236. +113 −113 tests/modeltests/model_forms/tests.py
  237. +6 −4 tests/modeltests/model_formsets/models.py
  238. +41 −41 tests/modeltests/model_formsets/tests.py
  239. +8 −7 tests/modeltests/model_inheritance/models.py
  240. +5 −4 tests/modeltests/one_to_one/models.py
  241. +4 −4 tests/modeltests/pagination/tests.py
  242. +19 −19 tests/modeltests/prefetch_related/tests.py
  243. +3 −3 tests/modeltests/proxy_models/tests.py
  244. +2 −1  tests/modeltests/save_delete_hooks/models.py
  245. +3 −3 tests/modeltests/select_related/tests.py
  246. +3 −2 tests/modeltests/serializers/models.py
  247. +3 −3 tests/modeltests/serializers/tests.py
  248. +3 −2 tests/modeltests/signals/models.py
  249. +2 −2 tests/modeltests/str/tests.py
  250. +3 −3 tests/modeltests/test_client/models.py
  251. +17 −15 tests/modeltests/timezones/tests.py
  252. +2 −1  tests/modeltests/transactions/models.py
  253. +5 −5 tests/modeltests/update/tests.py
  254. +5 −3 tests/modeltests/validation/models.py
  255. +36 −34 tests/modeltests/validation/test_error_messages.py
  256. +7 −7 tests/modeltests/validation/test_unique.py
  257. +2 −2 tests/modeltests/validation/tests.py
  258. +2 −2 tests/modeltests/validation/validators.py
  259. +9 −6 tests/modeltests/validators/tests.py
  260. +4 −4 tests/regressiontests/admin_custom_urls/tests.py
  261. +4 −2 tests/regressiontests/admin_filters/models.py
  262. +46 −46 tests/regressiontests/admin_filters/tests.py
  263. +4 −2 tests/regressiontests/admin_inlines/models.py
  264. +5 −5 tests/regressiontests/admin_inlines/tests.py
  265. +7 −7 tests/regressiontests/admin_ordering/tests.py
  266. +2 −2 tests/regressiontests/admin_util/tests.py
  267. +3 −3 tests/regressiontests/admin_views/admin.py
  268. +21 −19 tests/regressiontests/admin_views/models.py
  269. +133 −134 tests/regressiontests/admin_views/tests.py
  270. +3 −1 tests/regressiontests/admin_widgets/models.py
  271. +6 −6 tests/regressiontests/admin_widgets/tests.py
  272. +42 −42 tests/regressiontests/aggregation_regress/tests.py
  273. +4 −2 tests/regressiontests/backends/models.py
  274. +4 −4 tests/regressiontests/backends/tests.py
  275. +11 −11 tests/regressiontests/cache/tests.py
  276. +3 −3 tests/regressiontests/comment_tests/tests/comment_view_tests.py
  277. +5 −4 tests/regressiontests/csrf_tests/tests.py
  278. +2 −1  tests/regressiontests/custom_columns_regress/models.py
  279. +3 −3 tests/regressiontests/datatypes/tests.py
  280. +325 −324 tests/regressiontests/defaultfilters/tests.py
  281. +2 −1  tests/regressiontests/expressions_regress/models.py
  282. +4 −2 tests/regressiontests/extra_regress/models.py
  283. +18 −18 tests/regressiontests/extra_regress/tests.py
  284. +4 −4 tests/regressiontests/file_storage/tests.py
  285. +11 −12 tests/regressiontests/file_uploads/tests.py
  286. +2 −2 tests/regressiontests/file_uploads/views.py
  287. +5 −5 tests/regressiontests/fixtures_regress/models.py
  288. +2 −2 tests/regressiontests/fixtures_regress/tests.py
  289. +4 −2 tests/regressiontests/forms/models.py
  290. +58 −59 tests/regressiontests/forms/tests/error_messages.py
  291. +87 −88 tests/regressiontests/forms/tests/extra.py
  292. +285 −283 tests/regressiontests/forms/tests/fields.py
  293. +130 −127 tests/regressiontests/forms/tests/forms.py
  294. +45 −43 tests/regressiontests/forms/tests/formsets.py
  295. +9 −9 tests/regressiontests/forms/tests/models.py
  296. +20 −14 tests/regressiontests/forms/tests/regressions.py
  297. +9 −7 tests/regressiontests/forms/tests/util.py
  298. +163 −162 tests/regressiontests/forms/tests/widgets.py
  299. +20 −21 tests/regressiontests/generic_inline_admin/tests.py
  300. +30 −28 tests/regressiontests/httpwrappers/tests.py
Sorry, we could not display the entire diff because too many files (401) changed.
View
146 django/conf/locale/__init__.py
@@ -1,434 +1,436 @@
+from __future__ import unicode_literals
+
LANG_INFO = {
'ar': {
'bidi': True,
'code': 'ar',
'name': 'Arabic',
- 'name_local': u'\u0627\u0644\u0639\u0631\u0628\u064a\u0651\u0629',
+ 'name_local': '\u0627\u0644\u0639\u0631\u0628\u064a\u0651\u0629',
},
'az': {
'bidi': True,
'code': 'az',
'name': 'Azerbaijani',
- 'name_local': u'az\u0259rbaycan dili',
+ 'name_local': 'az\u0259rbaycan dili',
},
'bg': {
'bidi': False,
'code': 'bg',
'name': 'Bulgarian',
- 'name_local': u'\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438',
+ 'name_local': '\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438',
},
'bn': {
'bidi': False,
'code': 'bn',
'name': 'Bengali',
- 'name_local': u'\u09ac\u09be\u0982\u09b2\u09be',
+ 'name_local': '\u09ac\u09be\u0982\u09b2\u09be',
},
'bs': {
'bidi': False,
'code': 'bs',
'name': 'Bosnian',
- 'name_local': u'bosanski',
+ 'name_local': 'bosanski',
},
'ca': {
'bidi': False,
'code': 'ca',
'name': 'Catalan',
- 'name_local': u'catal\xe0',
+ 'name_local': 'catal\xe0',
},
'cs': {
'bidi': False,
'code': 'cs',
'name': 'Czech',
- 'name_local': u'\u010desky',
+ 'name_local': '\u010desky',
},
'cy': {
'bidi': False,
'code': 'cy',
'name': 'Welsh',
- 'name_local': u'Cymraeg',
+ 'name_local': 'Cymraeg',
},
'da': {
'bidi': False,
'code': 'da',
'name': 'Danish',
- 'name_local': u'Dansk',
+ 'name_local': 'Dansk',
},
'de': {
'bidi': False,
'code': 'de',
'name': 'German',
- 'name_local': u'Deutsch',
+ 'name_local': 'Deutsch',
},
'el': {
'bidi': False,
'code': 'el',
'name': 'Greek',
- 'name_local': u'\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac',
+ 'name_local': '\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac',
},
'en': {
'bidi': False,
'code': 'en',
'name': 'English',
- 'name_local': u'English',
+ 'name_local': 'English',
},
'en-gb': {
'bidi': False,
'code': 'en-gb',
'name': 'British English',
- 'name_local': u'British English',
+ 'name_local': 'British English',
},
'eo': {
'bidi': False,
'code': 'eo',
'name': 'Esperanto',
- 'name_local': u'Esperanto',
+ 'name_local': 'Esperanto',
},
'es': {
'bidi': False,
'code': 'es',
'name': 'Spanish',
- 'name_local': u'espa\xf1ol',
+ 'name_local': 'espa\xf1ol',
},
'es-ar': {
'bidi': False,
'code': 'es-ar',
'name': 'Argentinian Spanish',
- 'name_local': u'espa\xf1ol de Argentina',
+ 'name_local': 'espa\xf1ol de Argentina',
},
'es-mx': {
'bidi': False,
'code': 'es-mx',
'name': 'Mexican Spanish',
- 'name_local': u'espa\xf1ol de Mexico',
+ 'name_local': 'espa\xf1ol de Mexico',
},
'es-ni': {
'bidi': False,
'code': 'es-ni',
'name': 'Nicaraguan Spanish',
- 'name_local': u'espa\xf1ol de Nicaragua',
+ 'name_local': 'espa\xf1ol de Nicaragua',
},
'et': {
'bidi': False,
'code': 'et',
'name': 'Estonian',
- 'name_local': u'eesti',
+ 'name_local': 'eesti',
},
'eu': {
'bidi': False,
'code': 'eu',
'name': 'Basque',
- 'name_local': u'Basque',
+ 'name_local': 'Basque',
},
'fa': {
'bidi': True,
'code': 'fa',
'name': 'Persian',
- 'name_local': u'\u0641\u0627\u0631\u0633\u06cc',
+ 'name_local': '\u0641\u0627\u0631\u0633\u06cc',
},
'fi': {
'bidi': False,
'code': 'fi',
'name': 'Finnish',
- 'name_local': u'suomi',
+ 'name_local': 'suomi',
},
'fr': {
'bidi': False,
'code': 'fr',
'name': 'French',
- 'name_local': u'Fran\xe7ais',
+ 'name_local': 'Fran\xe7ais',
},
'fy-nl': {
'bidi': False,
'code': 'fy-nl',
'name': 'Frisian',
- 'name_local': u'Frisian',
+ 'name_local': 'Frisian',
},
'ga': {
'bidi': False,
'code': 'ga',
'name': 'Irish',
- 'name_local': u'Gaeilge',
+ 'name_local': 'Gaeilge',
},
'gl': {
'bidi': False,
'code': 'gl',
'name': 'Galician',
- 'name_local': u'galego',
+ 'name_local': 'galego',
},
'he': {
'bidi': True,
'code': 'he',
'name': 'Hebrew',
- 'name_local': u'\u05e2\u05d1\u05e8\u05d9\u05ea',
+ 'name_local': '\u05e2\u05d1\u05e8\u05d9\u05ea',
},
'hi': {
'bidi': False,
'code': 'hi',
'name': 'Hindi',
- 'name_local': u'Hindi',
+ 'name_local': 'Hindi',
},
'hr': {
'bidi': False,
'code': 'hr',
'name': 'Croatian',
- 'name_local': u'Hrvatski',
+ 'name_local': 'Hrvatski',
},
'hu': {
'bidi': False,
'code': 'hu',
'name': 'Hungarian',
- 'name_local': u'Magyar',
+ 'name_local': 'Magyar',
},
'id': {
'bidi': False,
'code': 'id',
'name': 'Indonesian',
- 'name_local': u'Bahasa Indonesia',
+ 'name_local': 'Bahasa Indonesia',
},
'is': {
'bidi': False,
'code': 'is',
'name': 'Icelandic',
- 'name_local': u'\xcdslenska',
+ 'name_local': '\xcdslenska',
},
'it': {
'bidi': False,
'code': 'it',
'name': 'Italian',
- 'name_local': u'italiano',
+ 'name_local': 'italiano',
},
'ja': {
'bidi': False,
'code': 'ja',
'name': 'Japanese',
- 'name_local': u'\u65e5\u672c\u8a9e',
+ 'name_local': '\u65e5\u672c\u8a9e',
},
'ka': {
'bidi': False,
'code': 'ka',
'name': 'Georgian',
- 'name_local': u'\u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8',
+ 'name_local': '\u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8',
},
'kk': {
'bidi': False,
'code': 'kk',
'name': 'Kazakh',
- 'name_local': u'\u049a\u0430\u0437\u0430\u049b',
+ 'name_local': '\u049a\u0430\u0437\u0430\u049b',
},
'km': {
'bidi': False,
'code': 'km',
'name': 'Khmer',
- 'name_local': u'Khmer',
+ 'name_local': 'Khmer',
},
'kn': {
'bidi': False,
'code': 'kn',
'name': 'Kannada',
- 'name_local': u'Kannada',
+ 'name_local': 'Kannada',
},
'ko': {
'bidi': False,
'code': 'ko',
'name': 'Korean',
- 'name_local': u'\ud55c\uad6d\uc5b4',
+ 'name_local': '\ud55c\uad6d\uc5b4',
},
'lt': {
'bidi': False,
'code': 'lt',
'name': 'Lithuanian',
- 'name_local': u'Lithuanian',
+ 'name_local': 'Lithuanian',
},
'lv': {
'bidi': False,
'code': 'lv',
'name': 'Latvian',
- 'name_local': u'latvie\u0161u',
+ 'name_local': 'latvie\u0161u',
},
'mk': {
'bidi': False,
'code': 'mk',
'name': 'Macedonian',
- 'name_local': u'\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438',
+ 'name_local': '\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438',
},
'ml': {
'bidi': False,
'code': 'ml',
'name': 'Malayalam',
- 'name_local': u'Malayalam',
+ 'name_local': 'Malayalam',
},
'mn': {
'bidi': False,
'code': 'mn',
'name': 'Mongolian',
- 'name_local': u'Mongolian',
+ 'name_local': 'Mongolian',
},
'nb': {
'bidi': False,
'code': 'nb',
'name': 'Norwegian Bokmal',
- 'name_local': u'Norsk (bokm\xe5l)',
+ 'name_local': 'Norsk (bokm\xe5l)',
},
'ne': {
'bidi': False,
'code': 'ne',
'name': 'Nepali',
- 'name_local': u'\u0928\u0947\u092a\u093e\u0932\u0940',
+ 'name_local': '\u0928\u0947\u092a\u093e\u0932\u0940',
},
'nl': {
'bidi': False,
'code': 'nl',
'name': 'Dutch',
- 'name_local': u'Nederlands',
+ 'name_local': 'Nederlands',
},
'nn': {
'bidi': False,
'code': 'nn',
'name': 'Norwegian Nynorsk',
- 'name_local': u'Norsk (nynorsk)',
+ 'name_local': 'Norsk (nynorsk)',
},
'no': {
'bidi': False,
'code': 'no',
'name': 'Norwegian',
- 'name_local': u'Norsk',
+ 'name_local': 'Norsk',
},
'pa': {
'bidi': False,
'code': 'pa',
'name': 'Punjabi',
- 'name_local': u'Punjabi',
+ 'name_local': 'Punjabi',
},
'pl': {
'bidi': False,
'code': 'pl',
'name': 'Polish',
- 'name_local': u'polski',
+ 'name_local': 'polski',
},
'pt': {
'bidi': False,
'code': 'pt',
'name': 'Portuguese',
- 'name_local': u'Portugu\xeas',
+ 'name_local': 'Portugu\xeas',
},
'pt-br': {
'bidi': False,
'code': 'pt-br',
'name': 'Brazilian Portuguese',
- 'name_local': u'Portugu\xeas Brasileiro',
+ 'name_local': 'Portugu\xeas Brasileiro',
},
'ro': {
'bidi': False,
'code': 'ro',
'name': 'Romanian',
- 'name_local': u'Rom\xe2n\u0103',
+ 'name_local': 'Rom\xe2n\u0103',
},
'ru': {
'bidi': False,
'code': 'ru',
'name': 'Russian',
- 'name_local': u'\u0420\u0443\u0441\u0441\u043a\u0438\u0439',
+ 'name_local': '\u0420\u0443\u0441\u0441\u043a\u0438\u0439',
},
'sk': {
'bidi': False,
'code': 'sk',
'name': 'Slovak',
- 'name_local': u'slovensk\xfd',
+ 'name_local': 'slovensk\xfd',
},
'sl': {
'bidi': False,
'code': 'sl',
'name': 'Slovenian',
- 'name_local': u'Sloven\u0161\u010dina',
+ 'name_local': 'Sloven\u0161\u010dina',
},
'sq': {
'bidi': False,
'code': 'sq',
'name': 'Albanian',
- 'name_local': u'Albanian',
+ 'name_local': 'Albanian',
},
'sr': {
'bidi': False,
'code': 'sr',
'name': 'Serbian',
- 'name_local': u'\u0441\u0440\u043f\u0441\u043a\u0438',
+ 'name_local': '\u0441\u0440\u043f\u0441\u043a\u0438',
},
'sr-latn': {
'bidi': False,
'code': 'sr-latn',
'name': 'Serbian Latin',
- 'name_local': u'srpski (latinica)',
+ 'name_local': 'srpski (latinica)',
},
'sv': {
'bidi': False,
'code': 'sv',
'name': 'Swedish',
- 'name_local': u'Svenska',
+ 'name_local': 'Svenska',
},
'sw': {
'bidi': False,
'code': 'sw',
'name': 'Swahili',
- 'name_local': u'Kiswahili',
+ 'name_local': 'Kiswahili',
},
'ta': {
'bidi': False,
'code': 'ta',
'name': 'Tamil',
- 'name_local': u'\u0ba4\u0bae\u0bbf\u0bb4\u0bcd',
+ 'name_local': '\u0ba4\u0bae\u0bbf\u0bb4\u0bcd',
},
'te': {
'bidi': False,
'code': 'te',
'name': 'Telugu',
- 'name_local': u'\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41',
+ 'name_local': '\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41',
},
'th': {
'bidi': False,
'code': 'th',
'name': 'Thai',
- 'name_local': u'Thai',
+ 'name_local': 'Thai',
},
'tr': {
'bidi': False,
'code': 'tr',
'name': 'Turkish',
- 'name_local': u'T\xfcrk\xe7e',
+ 'name_local': 'T\xfcrk\xe7e',
},
'tt': {
'bidi': False,
'code': 'tt',
'name': 'Tatar',
- 'name_local': u'\u0422\u0430\u0442\u0430\u0440\u0447\u0430',
+ 'name_local': '\u0422\u0430\u0442\u0430\u0440\u0447\u0430',
},
'uk': {
'bidi': False,
'code': 'uk',
'name': 'Ukrainian',
- 'name_local': u'\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430',
+ 'name_local': '\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430',
},
'ur': {
'bidi': False,
'code': 'ur',
'name': 'Urdu',
- 'name_local': u'\u0627\u0631\u062f\u0648',
+ 'name_local': '\u0627\u0631\u062f\u0648',
},
'vi': {
'bidi': False,
'code': 'vi',
'name': 'Vietnamese',
- 'name_local': u'Vietnamese',
+ 'name_local': 'Vietnamese',
},
'zh-cn': {
'bidi': False,
'code': 'zh-cn',
'name': 'Simplified Chinese',
- 'name_local': u'\u7b80\u4f53\u4e2d\u6587',
+ 'name_local': '\u7b80\u4f53\u4e2d\u6587',
},
'zh-tw': {
'bidi': False,
'code': 'zh-tw',
'name': 'Traditional Chinese',
- 'name_local': u'\u7e41\u9ad4\u4e2d\u6587',
+ 'name_local': '\u7e41\u9ad4\u4e2d\u6587',
}
}
View
3  django/conf/locale/bg/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -19,5 +20,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING =
View
3  django/conf/locale/cs/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -33,5 +34,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
4 django/conf/locale/en/formats.py
@@ -37,7 +37,7 @@
'%m/%d/%y %H:%M', # '10/25/06 14:30'
'%m/%d/%y', # '10/25/06'
)
-DECIMAL_SEPARATOR = u'.'
-THOUSAND_SEPARATOR = u','
+DECIMAL_SEPARATOR = '.'
+THOUSAND_SEPARATOR = ','
NUMBER_GROUPING = 3
View
3  django/conf/locale/es_MX/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
DATE_FORMAT = r'j \d\e F \d\e Y'
TIME_FORMAT = 'H:i:s'
@@ -24,5 +25,5 @@
'%d/%m/%y %H:%M',
)
DECIMAL_SEPARATOR = '.' # ',' is also official (less common): NOM-008-SCFI-2002
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
3  django/conf/locale/et/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -19,5 +20,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING =
View
3  django/conf/locale/fi/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -19,5 +20,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
# NUMBER_GROUPING =
View
3  django/conf/locale/fr/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -37,5 +38,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
1  django/conf/locale/he/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
View
3  django/conf/locale/hu/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -28,5 +29,5 @@
'%Y.%m.%d.', # '2006.10.25.'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
NUMBER_GROUPING = 3
View
1  django/conf/locale/ja/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
View
1  django/conf/locale/km/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
View
1  django/conf/locale/ko/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
View
3  django/conf/locale/lv/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -37,5 +38,5 @@
'%d.%m.%y', # '25.10.06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' ' # Non-breaking space
+THOUSAND_SEPARATOR = ' ' # Non-breaking space
NUMBER_GROUPING = 3
View
3  django/conf/locale/nb/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -39,5 +40,5 @@
'%d.%m.%y', # '25.10.06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
3  django/conf/locale/nn/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -39,5 +40,5 @@
'%d.%m.%y', # '25.10.06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
3  django/conf/locale/pl/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -33,5 +34,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' '
+THOUSAND_SEPARATOR = ' '
NUMBER_GROUPING = 3
View
1  django/conf/locale/pt_BR/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
View
3  django/conf/locale/ru/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -36,5 +37,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
3  django/conf/locale/sk/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -33,5 +34,5 @@
'%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
3  django/conf/locale/sv/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
@@ -36,5 +37,5 @@
'%m/%d/%y', # '10/25/06'
)
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u'\xa0' # non-breaking space
+THOUSAND_SEPARATOR = '\xa0' # non-breaking space
NUMBER_GROUPING = 3
View
4 django/conf/locale/uk/formats.py
@@ -2,6 +2,8 @@
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
+
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j E Y р.'
@@ -19,5 +21,5 @@
# TIME_INPUT_FORMATS =
# DATETIME_INPUT_FORMATS =
DECIMAL_SEPARATOR = ','
-THOUSAND_SEPARATOR = u' '
+THOUSAND_SEPARATOR = ' '
# NUMBER_GROUPING =
View
1  django/conf/locale/vi/formats.py
@@ -1,6 +1,7 @@
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
+from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
View
5 django/contrib/admin/forms.py
@@ -1,9 +1,10 @@
+from __future__ import unicode_literals
+
from django import forms
from django.contrib.auth import authenticate
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
-
from django.utils.translation import ugettext_lazy, ugettext as _
ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
@@ -25,7 +26,7 @@ def clean(self):
if username and password:
self.user_cache = authenticate(username=username, password=password)
if self.user_cache is None:
- if u'@' in username:
+ if '@' in username:
# Mistakenly entered e-mail address instead of username? Look it up.
try:
user = User.objects.get(email=username)
View
18 django/contrib/admin/helpers.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django import forms
from django.contrib.admin.util import (flatten_fieldsets, lookup_field,
display_for_field, label_for_field, help_text_for_field)
@@ -69,7 +71,7 @@ def __init__(self, form, name=None, readonly_fields=(), fields=(), classes=(),
description=None, model_admin=None):
self.form = form
self.name, self.fields = name, fields
- self.classes = u' '.join(classes)
+ self.classes = ' '.join(classes)
self.description = description
self.model_admin = model_admin
self.readonly_fields = readonly_fields
@@ -109,7 +111,7 @@ def __iter__(self):
yield AdminField(self.form, field, is_first=(i == 0))
def errors(self):
- return mark_safe(u'\n'.join([self.form[f].errors.as_ul() for f in self.fields if f not in self.readonly_fields]).strip('\n'))
+ return mark_safe('\n'.join([self.form[f].errors.as_ul() for f in self.fields if f not in self.readonly_fields]).strip('\n'))
class AdminField(object):
def __init__(self, form, field, is_first):
@@ -121,14 +123,14 @@ def label_tag(self):
classes = []
contents = conditional_escape(force_unicode(self.field.label))
if self.is_checkbox:
- classes.append(u'vCheckboxLabel')
+ classes.append('vCheckboxLabel')
else:
- contents += u':'
+ contents += ':'
if self.field.field.required:
- classes.append(u'required')
+ classes.append('required')
if not self.is_first:
- classes.append(u'inline')
- attrs = classes and {'class': u' '.join(classes)} or {}
+ classes.append('inline')
+ attrs = classes and {'class': ' '.join(classes)} or {}
return self.field.label_tag(contents=mark_safe(contents), attrs=attrs)
def errors(self):
@@ -161,7 +163,7 @@ def label_tag(self):
if not self.is_first:
attrs["class"] = "inline"
label = self.field['label']
- contents = capfirst(force_unicode(escape(label))) + u":"
+ contents = capfirst(force_unicode(escape(label))) + ":"
return mark_safe('<label%(attrs)s>%(contents)s</label>' % {
"attrs": flatatt(attrs),
"contents": contents,
View
4 django/contrib/admin/models.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
@@ -64,5 +66,5 @@ def get_admin_url(self):
This is relative to the Django admin index page.
"""
if self.content_type and self.object_id:
- return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
+ return mark_safe("%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
return None
View
18 django/contrib/admin/templatetags/admin_list.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import datetime
from django.contrib.admin.util import (lookup_field, display_for_field,
@@ -27,11 +29,11 @@ def paginator_number(cl,i):
Generates an individual page index link in a paginated list.
"""
if i == DOT:
- return u'... '
+ return '... '
elif i == cl.page_num:
- return mark_safe(u'<span class="this-page">%d</span> ' % (i+1))
+ return mark_safe('<span class="this-page">%d</span> ' % (i+1))
else:
- return mark_safe(u'<a href="%s"%s>%d</a> ' % (escape(cl.get_query_string({PAGE_VAR: i})), (i == cl.paginator.num_pages-1 and ' class="end"' or ''), i+1))
+ return mark_safe('<a href="%s"%s>%d</a> ' % (escape(cl.get_query_string({PAGE_VAR: i})), (i == cl.paginator.num_pages-1 and ' class="end"' or ''), i+1))
@register.inclusion_tag('admin/pagination.html')
def pagination(cl):
@@ -163,7 +165,7 @@ def result_headers(cl):
def _boolean_icon(field_val):
icon_url = static('admin/img/icon-%s.gif' %
{True: 'yes', False: 'no', None: 'unknown'}[field_val])
- return mark_safe(u'<img src="%s" alt="%s" />' % (icon_url, field_val))
+ return mark_safe('<img src="%s" alt="%s" />' % (icon_url, field_val))
def items_for_result(cl, result, form):
"""
@@ -179,7 +181,7 @@ def items_for_result(cl, result, form):
result_repr = EMPTY_CHANGELIST_VALUE
else:
if f is None:
- if field_name == u'action_checkbox':
+ if field_name == 'action_checkbox':
row_class = ' class="action-checkbox"'
allow_tags = getattr(attr, 'allow_tags', False)
boolean = getattr(attr, 'boolean', False)
@@ -220,7 +222,7 @@ def items_for_result(cl, result, form):
attr = pk
value = result.serializable_value(attr)
result_id = repr(force_unicode(value))[1:]
- yield mark_safe(u'<%s%s><a href="%s"%s>%s</a></%s>' % \
+ yield mark_safe('<%s%s><a href="%s"%s>%s</a></%s>' % \
(table_tag, row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %s); return false;"' % result_id or ''), conditional_escape(result_repr), table_tag))
else:
# By default the fields come from ModelAdmin.list_editable, but if we pull
@@ -233,9 +235,9 @@ def items_for_result(cl, result, form):
result_repr = mark_safe(force_unicode(bf.errors) + force_unicode(bf))
else:
result_repr = conditional_escape(result_repr)
- yield mark_safe(u'<td%s>%s</td>' % (row_class, result_repr))
+ yield mark_safe('<td%s>%s</td>' % (row_class, result_repr))
if form and not form[cl.model._meta.pk.name].is_hidden:
- yield mark_safe(u'<td>%s</td>' % force_unicode(form[cl.model._meta.pk.name]))
+ yield mark_safe('<td>%s</td>' % force_unicode(form[cl.model._meta.pk.name]))
class ResultList(list):
# Wrapper class used to return items in a list_editable
View
6 django/contrib/admin/util.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import datetime
import decimal
@@ -122,14 +124,14 @@ def format_callback(obj):
if not user.has_perm(p):
perms_needed.add(opts.verbose_name)
# Display a link to the admin page.
- return mark_safe(u'%s: <a href="%s">%s</a>' %
+ return mark_safe('%s: <a href="%s">%s</a>' %
(escape(capfirst(opts.verbose_name)),
admin_url,
escape(obj)))
else:
# Don't display link to edit, because it either has no
# admin or is edited inline.
- return u'%s: %s' % (capfirst(opts.verbose_name),
+ return '%s: %s' % (capfirst(opts.verbose_name),
force_unicode(obj))
to_delete = collector.nested(format_callback)
View
36 django/contrib/admin/widgets.py
@@ -1,8 +1,10 @@
"""
Form Widget classes specific to the Django admin site.
"""
+from __future__ import unicode_literals
import copy
+
from django import forms
from django.contrib.admin.templatetags.admin_static import static
from django.core.urlresolvers import reverse
@@ -39,12 +41,12 @@ def render(self, name, value, attrs=None, choices=()):
if self.is_stacked:
attrs['class'] += 'stacked'
output = [super(FilteredSelectMultiple, self).render(name, value, attrs, choices)]
- output.append(u'<script type="text/javascript">addEvent(window, "load", function(e) {')
+ output.append('<script type="text/javascript">addEvent(window, "load", function(e) {')
# TODO: "id_" is hard-coded here. This should instead use the correct
# API to determine the ID dynamically.
- output.append(u'SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n'
+ output.append('SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n'
% (name, self.verbose_name.replace('"', '\\"'), int(self.is_stacked), static('admin/')))
- return mark_safe(u''.join(output))
+ return mark_safe(''.join(output))
class AdminDateWidget(forms.DateInput):
@@ -83,24 +85,24 @@ def __init__(self, attrs=None):
forms.MultiWidget.__init__(self, widgets, attrs)
def format_output(self, rendered_widgets):
- return mark_safe(u'<p class="datetime">%s %s<br />%s %s</p>' % \
+ return mark_safe('<p class="datetime">%s %s<br />%s %s</p>' % \
(_('Date:'), rendered_widgets[0], _('Time:'), rendered_widgets[1]))
class AdminRadioFieldRenderer(RadioFieldRenderer):
def render(self):
"""Outputs a <ul> for this set of radio fields."""
- return mark_safe(u'<ul%s>\n%s\n</ul>' % (
+ return mark_safe('<ul%s>\n%s\n</ul>' % (
flatatt(self.attrs),
- u'\n'.join([u'<li>%s</li>' % force_unicode(w) for w in self]))
+ '\n'.join(['<li>%s</li>' % force_unicode(w) for w in self]))
)
class AdminRadioSelect(forms.RadioSelect):
renderer = AdminRadioFieldRenderer
class AdminFileWidget(forms.ClearableFileInput):
- template_with_initial = (u'<p class="file-upload">%s</p>'
+ template_with_initial = ('<p class="file-upload">%s</p>'
% forms.ClearableFileInput.template_with_initial)
- template_with_clear = (u'<span class="clearable-file-input">%s</span>'
+ template_with_clear = ('<span class="clearable-file-input">%s</span>'
% forms.ClearableFileInput.template_with_clear)
def url_params_from_lookup_dict(lookups):
@@ -113,7 +115,7 @@ def url_params_from_lookup_dict(lookups):
items = []
for k, v in lookups.items():
if isinstance(v, (tuple, list)):
- v = u','.join([str(x) for x in v])
+ v = ','.join([str(x) for x in v])
elif isinstance(v, bool):
# See django.db.fields.BooleanField.get_prep_lookup
v = ('0', '1')[v]
@@ -148,21 +150,21 @@ def render(self, name, value, attrs=None):
params = self.url_parameters()
if params:
- url = u'?' + u'&amp;'.join([u'%s=%s' % (k, v) for k, v in params.items()])
+ url = '?' + '&amp;'.join(['%s=%s' % (k, v) for k, v in params.items()])
else:
- url = u''
+ url = ''
if "class" not in attrs:
attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook.
# TODO: "lookup_id_" is hard-coded here. This should instead use
# the correct API to determine the ID dynamically.
- extra.append(u'<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> '
+ extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> '
% (related_url, url, name))
- extra.append(u'<img src="%s" width="16" height="16" alt="%s" /></a>'
+ extra.append('<img src="%s" width="16" height="16" alt="%s" /></a>'
% (static('admin/img/selector-search.gif'), _('Lookup')))
output = [super(ForeignKeyRawIdWidget, self).render(name, value, attrs)] + extra
if value:
output.append(self.label_for_value(value))
- return mark_safe(u''.join(output))
+ return mark_safe(''.join(output))
def base_url_parameters(self):
return url_params_from_lookup_dict(self.rel.limit_choices_to)
@@ -261,11 +263,11 @@ def render(self, name, value, *args, **kwargs):
related_url = reverse('admin:%s_%s_add' % info, current_app=self.admin_site.name)
# TODO: "add_id_" is hard-coded here. This should instead use the
# correct API to determine the ID dynamically.
- output.append(u'<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
+ output.append('<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> '
% (related_url, name))
- output.append(u'<img src="%s" width="10" height="10" alt="%s"/></a>'
+ output.append('<img src="%s" width="10" height="10" alt="%s"/></a>'
% (static('admin/img/icon_addlink.gif'), _('Add Another')))
- return mark_safe(u''.join(output))
+ return mark_safe(''.join(output))
def build_attrs(self, extra_attrs=None, **kwargs):
"Helper function for building an attribute dictionary."
View
8 django/contrib/admindocs/tests/__init__.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, unicode_literals
from django.contrib.admindocs import views
from django.db.models import fields as builtin_fields
@@ -20,17 +20,17 @@ def test_field_name(self):
def test_builtin_fields(self):
self.assertEqual(
views.get_readable_field_data_type(builtin_fields.BooleanField()),
- _(u'Boolean (Either True or False)')
+ _('Boolean (Either True or False)')
)
def test_custom_fields(self):
self.assertEqual(
views.get_readable_field_data_type(fields.CustomField()),
- _(u'A custom field type')
+ _('A custom field type')
)
self.assertEqual(
views.get_readable_field_data_type(fields.DescriptionLackingField()),
- _(u'Field of type: %(field_type)s') % {
+ _('Field of type: %(field_type)s') % {
'field_type': 'DescriptionLackingField'
}
)
View
4 django/contrib/auth/backends.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.contrib.auth.models import User, Permission
@@ -36,7 +38,7 @@ def get_all_permissions(self, user_obj, obj=None):
if user_obj.is_anonymous() or obj is not None:
return set()
if not hasattr(user_obj, '_perm_cache'):
- user_obj._perm_cache = set([u"%s.%s" % (p.content_type.app_label, p.codename) for p in user_obj.user_permissions.select_related()])
+ user_obj._perm_cache = set(["%s.%s" % (p.content_type.app_label, p.codename) for p in user_obj.user_permissions.select_related()])
user_obj._perm_cache.update(self.get_group_permissions(user_obj))
return user_obj._perm_cache
View
2  django/contrib/auth/hashers.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import hashlib
from django.dispatch import receiver
View
8 django/contrib/auth/management/__init__.py
@@ -1,6 +1,8 @@
"""
Creates permissions for all installed apps that need permissions.
"""
+from __future__ import unicode_literals
+
import getpass
import locale
import unicodedata
@@ -10,14 +12,14 @@
def _get_permission_codename(action, opts):
- return u'%s_%s' % (action, opts.object_name.lower())
+ return '%s_%s' % (action, opts.object_name.lower())
def _get_all_permissions(opts):
"Returns (codename, name) for all permissions in the given opts."
perms = []
for action in ('add', 'change', 'delete'):
- perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
+ perms.append((_get_permission_codename(action, opts), 'Can %s %s' % (action, opts.verbose_name_raw)))
return perms + list(opts.permissions)
@@ -88,7 +90,7 @@ def get_system_username():
# if there is no corresponding entry in the /etc/passwd file
# (a very restricted chroot environment, for example).
# UnicodeDecodeError - preventive treatment for non-latin Windows.
- return u''
+ return ''
def get_default_username(check_db=True):
View
6 django/contrib/auth/models.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import urllib
from django.core.exceptions import ImproperlyConfigured
@@ -76,7 +78,7 @@ class Meta:
'codename')
def __unicode__(self):
- return u"%s | %s | %s" % (
+ return "%s | %s | %s" % (
unicode(self.content_type.app_label),
unicode(self.content_type),
unicode(self.name))
@@ -285,7 +287,7 @@ def get_full_name(self):
"""
Returns the first_name plus the last_name, with a space in between.
"""
- full_name = u'%s %s' % (self.first_name, self.last_name)
+ full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip()
def set_password(self, raw_password):
View
10 django/contrib/auth/tests/auth_backends.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
@@ -51,7 +53,7 @@ def test_custom_perms(self):
# reloading user to purge the _perm_cache
user = User.objects.get(username='test')
- self.assertEqual(user.get_all_permissions() == set([u'auth.test']), True)
+ self.assertEqual(user.get_all_permissions() == set(['auth.test']), True)
self.assertEqual(user.get_group_permissions(), set([]))
self.assertEqual(user.has_module_perms('Group'), False)
self.assertEqual(user.has_module_perms('auth'), True)
@@ -62,7 +64,7 @@ def test_custom_perms(self):
user.user_permissions.add(perm)
user.save()
user = User.objects.get(username='test')
- self.assertEqual(user.get_all_permissions(), set([u'auth.test2', u'auth.test', u'auth.test3']))
+ self.assertEqual(user.get_all_permissions(), set(['auth.test2', 'auth.test', 'auth.test3']))
self.assertEqual(user.has_perm('test'), False)
self.assertEqual(user.has_perm('auth.test'), True)
self.assertEqual(user.has_perms(['auth.test2', 'auth.test3']), True)
@@ -72,9 +74,9 @@ def test_custom_perms(self):
group.save()
user.groups.add(group)
user = User.objects.get(username='test')
- exp = set([u'auth.test2', u'auth.test', u'auth.test3', u'auth.test_group'])
+ exp = set(['auth.test2', 'auth.test', 'auth.test3', 'auth.test_group'])
self.assertEqual(user.get_all_permissions(), exp)
- self.assertEqual(user.get_group_permissions(), set([u'auth.test_group']))
+ self.assertEqual(user.get_group_permissions(), set(['auth.test_group']))
self.assertEqual(user.has_perms(['auth.test3', 'auth.test_group']), True)
user = AnonymousUser()
View
6 django/contrib/auth/tests/forms.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import os
from django.contrib.auth.models import User
from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm,
@@ -299,7 +301,7 @@ def test_custom_email_subject(self):
# potential case where contrib.sites is not installed. Refs #16412.
form.save(domain_override='example.com')
self.assertEqual(len(mail.outbox), 1)
- self.assertEqual(mail.outbox[0].subject, u'Custom password reset on example.com')
+ self.assertEqual(mail.outbox[0].subject, 'Custom password reset on example.com')
def test_bug_5605(self):
# bug #5605, preserve the case of the user name (before the @ in the
@@ -328,4 +330,4 @@ def test_unusable_password(self):
form = PasswordResetForm(data)
self.assertFalse(form.is_valid())
self.assertEqual(form["email"].errors,
- [_(u"The user account associated with this e-mail address cannot reset the password.")])
+ [_("The user account associated with this e-mail address cannot reset the password.")])
View
18 django/contrib/auth/tests/hashers.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.conf.global_settings import PASSWORD_HASHERS as default_hashers
from django.contrib.auth.hashers import (is_password_usable,
check_password, make_password, PBKDF2PasswordHasher, load_hashers,
@@ -26,7 +28,7 @@ def test_simple(self):
encoded = make_password('letmein')
self.assertTrue(encoded.startswith('pbkdf2_sha256$'))
self.assertTrue(is_password_usable(encoded))
- self.assertTrue(check_password(u'letmein', encoded))
+ self.assertTrue(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
def test_pkbdf2(self):
@@ -34,7 +36,7 @@ def test_pkbdf2(self):
self.assertEqual(encoded,
'pbkdf2_sha256$10000$seasalt$FQCNpiZpTb0zub+HBsH6TOwyRxJ19FwvjbweatNmK/Y=')
self.assertTrue(is_password_usable(encoded))
- self.assertTrue(check_password(u'letmein', encoded))
+ self.assertTrue(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
self.assertEqual(identify_hasher(encoded).algorithm, "pbkdf2_sha256")
@@ -43,7 +45,7 @@ def test_sha1(self):
self.assertEqual(encoded,
'sha1$seasalt$fec3530984afba6bade3347b7140d1a7da7da8c7')
self.assertTrue(is_password_usable(encoded))
- self.assertTrue(check_password(u'letmein', encoded))
+ self.assertTrue(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
self.assertEqual(identify_hasher(encoded).algorithm, "sha1")
@@ -52,7 +54,7 @@ def test_md5(self):
self.assertEqual(encoded,
'md5$seasalt$f5531bef9f3687d0ccf0f617f0e25573')
self.assertTrue(is_password_usable(encoded))
- self.assertTrue(check_password(u'letmein', encoded))
+ self.assertTrue(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
self.assertEqual(identify_hasher(encoded).algorithm, "md5")
@@ -60,7 +62,7 @@ def test_unsalted_md5(self):
encoded = make_password('letmein', 'seasalt', 'unsalted_md5')
self.assertEqual(encoded, '0d107d09f5bbe40cade3de5c71e9e9b7')
self.assertTrue(is_password_usable(encoded))
- self.assertTrue(check_password(u'letmein', encoded))
+ self.assertTrue(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
self.assertEqual(identify_hasher(encoded).algorithm, "unsalted_md5")
@@ -69,7 +71,7 @@ def test_crypt(self):
encoded = make_password('letmein', 'ab', 'crypt')
self.assertEqual(encoded, 'crypt$$abN/qM.L/H8EQ')
self.assertTrue(is_password_usable(encoded))
- self.assertTrue(check_password(u'letmein', encoded))
+ self.assertTrue(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
self.assertEqual(identify_hasher(encoded).algorithm, "crypt")
@@ -78,7 +80,7 @@ def test_bcrypt(self):
encoded = make_password('letmein', hasher='bcrypt')
self.assertTrue(is_password_usable(encoded))
self.assertTrue(encoded.startswith('bcrypt$'))
- self.assertTrue(check_password(u'letmein', encoded))
+ self.assertTrue(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
self.assertEqual(identify_hasher(encoded).algorithm, "bcrypt")
@@ -88,7 +90,7 @@ def test_unusable(self):
self.assertFalse(check_password(None, encoded))
self.assertFalse(check_password(UNUSABLE_PASSWORD, encoded))
self.assertFalse(check_password('', encoded))
- self.assertFalse(check_password(u'letmein', encoded))
+ self.assertFalse(check_password('letmein', encoded))
self.assertFalse(check_password('letmeinz', encoded))
self.assertRaises(ValueError, identify_hasher, encoded)
View
8 django/contrib/auth/tests/management.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from StringIO import StringIO
from django.contrib.auth import models, management
@@ -15,19 +17,19 @@ def tearDown(self):
management.get_system_username = self._getpass_getuser
def test_simple(self):
- management.get_system_username = lambda: u'joe'
+ management.get_system_username = lambda: 'joe'
self.assertEqual(management.get_default_username(), 'joe')
def test_existing(self):
models.User.objects.create(username='joe')
- management.get_system_username = lambda: u'joe'
+ management.get_system_username = lambda: 'joe'
self.assertEqual(management.get_default_username(), '')
self.assertEqual(
management.get_default_username(check_db=False), 'joe')
def test_i18n(self):
# 'Julia' with accented 'u':
- management.get_system_username = lambda: u'J\xfalia'
+ management.get_system_username = lambda: 'J\xfalia'
self.assertEqual(management.get_default_username(), 'julia')
View
6 django/contrib/comments/admin.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from django.contrib i