Fixed capitalization of "ECMAScript" and "JavaScript".
This commit is contained in:
parent
907d3a7ff4
commit
2161db0792
|
@ -1,4 +1,4 @@
|
||||||
// Core javascript helper functions
|
// Core JavaScript helper functions
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
|
// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
|
||||||
|
|
|
@ -234,7 +234,7 @@ def items_for_result(cl, result, form):
|
||||||
link_or_text = result_repr
|
link_or_text = result_repr
|
||||||
else:
|
else:
|
||||||
url = add_preserved_filters({'preserved_filters': cl.preserved_filters, 'opts': cl.opts}, url)
|
url = add_preserved_filters({'preserved_filters': cl.preserved_filters, 'opts': cl.opts}, url)
|
||||||
# Convert the pk to something that can be used in Javascript.
|
# Convert the pk to something that can be used in JavaScript.
|
||||||
# Problem cases are non-ASCII strings.
|
# Problem cases are non-ASCII strings.
|
||||||
if cl.to_field:
|
if cl.to_field:
|
||||||
attr = str(cl.to_field)
|
attr = str(cl.to_field)
|
||||||
|
|
|
@ -10,7 +10,7 @@ register = template.Library()
|
||||||
|
|
||||||
def prepopulated_fields_js(context):
|
def prepopulated_fields_js(context):
|
||||||
"""
|
"""
|
||||||
Create a list of prepopulated_fields that should render Javascript for
|
Create a list of prepopulated_fields that should render JavaScript for
|
||||||
the prepopulated fields for both the admin form and inlines.
|
the prepopulated fields for both the admin form and inlines.
|
||||||
"""
|
"""
|
||||||
prepopulated_fields = []
|
prepopulated_fields = []
|
||||||
|
|
|
@ -581,7 +581,7 @@ class JsonResponse(HttpResponse):
|
||||||
An HTTP response class that consumes data to be serialized to JSON.
|
An HTTP response class that consumes data to be serialized to JSON.
|
||||||
|
|
||||||
:param data: Data to be dumped into json. By default only ``dict`` objects
|
:param data: Data to be dumped into json. By default only ``dict`` objects
|
||||||
are allowed to be passed due to a security flaw before EcmaScript 5. See
|
are allowed to be passed due to a security flaw before ECMAScript 5. See
|
||||||
the ``safe`` parameter for more information.
|
the ``safe`` parameter for more information.
|
||||||
:param encoder: Should be a json encoder class. Defaults to
|
:param encoder: Should be a json encoder class. Defaults to
|
||||||
``django.core.serializers.json.DjangoJSONEncoder``.
|
``django.core.serializers.json.DjangoJSONEncoder``.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""JsLex: a lexer for Javascript"""
|
"""JsLex: a lexer for JavaScript"""
|
||||||
# Originally from https://bitbucket.org/ned/jslex
|
# Originally from https://bitbucket.org/ned/jslex
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -75,23 +75,23 @@ class Lexer:
|
||||||
|
|
||||||
class JsLexer(Lexer):
|
class JsLexer(Lexer):
|
||||||
"""
|
"""
|
||||||
A Javascript lexer
|
A JavaScript lexer
|
||||||
|
|
||||||
>>> lexer = JsLexer()
|
>>> lexer = JsLexer()
|
||||||
>>> list(lexer.lex("a = 1"))
|
>>> list(lexer.lex("a = 1"))
|
||||||
[('id', 'a'), ('ws', ' '), ('punct', '='), ('ws', ' '), ('dnum', '1')]
|
[('id', 'a'), ('ws', ' '), ('punct', '='), ('ws', ' '), ('dnum', '1')]
|
||||||
|
|
||||||
This doesn't properly handle non-ASCII characters in the Javascript source.
|
This doesn't properly handle non-ASCII characters in the JavaScript source.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Because these tokens are matched as alternatives in a regex, longer
|
# Because these tokens are matched as alternatives in a regex, longer
|
||||||
# possibilities must appear in the list before shorter ones, for example,
|
# possibilities must appear in the list before shorter ones, for example,
|
||||||
# '>>' before '>'.
|
# '>>' before '>'.
|
||||||
#
|
#
|
||||||
# Note that we don't have to detect malformed Javascript, only properly
|
# Note that we don't have to detect malformed JavaScript, only properly
|
||||||
# lex correct Javascript, so much of this is simplified.
|
# lex correct JavaScript, so much of this is simplified.
|
||||||
|
|
||||||
# Details of Javascript lexical structure are taken from
|
# Details of JavaScript lexical structure are taken from
|
||||||
# http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf
|
# http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf
|
||||||
|
|
||||||
# A useful explanation of automatic semicolon insertion is at
|
# A useful explanation of automatic semicolon insertion is at
|
||||||
|
@ -184,7 +184,7 @@ class JsLexer(Lexer):
|
||||||
|
|
||||||
def prepare_js_for_gettext(js):
|
def prepare_js_for_gettext(js):
|
||||||
"""
|
"""
|
||||||
Convert the Javascript source `js` into something resembling C for
|
Convert the JavaScript source `js` into something resembling C for
|
||||||
xgettext.
|
xgettext.
|
||||||
|
|
||||||
What actually happens is that all the regex literals are replaced with
|
What actually happens is that all the regex literals are replaced with
|
||||||
|
|
|
@ -1099,7 +1099,7 @@ Without passing ``safe=False``, a :exc:`TypeError` will be raised.
|
||||||
it was possible to poison the JavaScript ``Array`` constructor. For this
|
it was possible to poison the JavaScript ``Array`` constructor. For this
|
||||||
reason, Django does not allow passing non-dict objects to the
|
reason, Django does not allow passing non-dict objects to the
|
||||||
:class:`~django.http.JsonResponse` constructor by default. However, most
|
:class:`~django.http.JsonResponse` constructor by default. However, most
|
||||||
modern browsers implement EcmaScript 5 which removes this attack vector.
|
modern browsers implement ECMAScript 5 which removes this attack vector.
|
||||||
Therefore it is possible to disable this security precaution.
|
Therefore it is possible to disable this security precaution.
|
||||||
|
|
||||||
Changing the default JSON encoder
|
Changing the default JSON encoder
|
||||||
|
|
|
@ -759,7 +759,7 @@ class PrePopulatedPostLargeSlug(models.Model):
|
||||||
"""
|
"""
|
||||||
Regression test for #15938: a large max_length for the slugfield must not
|
Regression test for #15938: a large max_length for the slugfield must not
|
||||||
be localized in prepopulated_fields_js.html or it might end up breaking
|
be localized in prepopulated_fields_js.html or it might end up breaking
|
||||||
the javascript (ie, using THOUSAND_SEPARATOR ends up with maxLength=1,000)
|
the JavaScript (ie, using THOUSAND_SEPARATOR ends up with maxLength=1,000)
|
||||||
"""
|
"""
|
||||||
title = models.CharField(max_length=100)
|
title = models.CharField(max_length=100)
|
||||||
published = models.BooleanField(default=False)
|
published = models.BooleanField(default=False)
|
||||||
|
|
|
@ -995,7 +995,7 @@ class DateTimePickerShortcutsSeleniumTests(AdminWidgetSeleniumTestCase):
|
||||||
with self.wait_page_loaded():
|
with self.wait_page_loaded():
|
||||||
self.selenium.find_element_by_name('_save').click()
|
self.selenium.find_element_by_name('_save').click()
|
||||||
|
|
||||||
# Make sure that "now" in javascript is within 10 seconds
|
# Make sure that "now" in JavaScript is within 10 seconds
|
||||||
# from "now" on the server side.
|
# from "now" on the server side.
|
||||||
member = Member.objects.get(name='test')
|
member = Member.objects.get(name='test')
|
||||||
self.assertGreater(member.birthdate, now - error_margin)
|
self.assertGreater(member.birthdate, now - error_margin)
|
||||||
|
|
|
@ -444,7 +444,7 @@ class BasicExtractorTests(ExtractorTests):
|
||||||
self.assertIn('mañana; charset=CHARSET', pot_contents)
|
self.assertIn('mañana; charset=CHARSET', pot_contents)
|
||||||
|
|
||||||
|
|
||||||
class JavascriptExtractorTests(ExtractorTests):
|
class JavaScriptExtractorTests(ExtractorTests):
|
||||||
|
|
||||||
PO_FILE = 'locale/%s/LC_MESSAGES/djangojs.po' % LOCALE
|
PO_FILE = 'locale/%s/LC_MESSAGES/djangojs.po' % LOCALE
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ class I18NViewTests(SimpleTestCase):
|
||||||
|
|
||||||
def test_i18n_language_non_english_default(self):
|
def test_i18n_language_non_english_default(self):
|
||||||
"""
|
"""
|
||||||
Check if the Javascript i18n view returns an empty language catalog
|
Check if the JavaScript i18n view returns an empty language catalog
|
||||||
if the default language is non-English, the selected language
|
if the default language is non-English, the selected language
|
||||||
is English and there is not 'en' translation available. See #13388,
|
is English and there is not 'en' translation available. See #13388,
|
||||||
#3594 and #13726 for more details.
|
#3594 and #13726 for more details.
|
||||||
|
@ -337,7 +337,7 @@ class I18NViewTests(SimpleTestCase):
|
||||||
def test_non_english_default_english_userpref(self):
|
def test_non_english_default_english_userpref(self):
|
||||||
"""
|
"""
|
||||||
Same as above with the difference that there IS an 'en' translation
|
Same as above with the difference that there IS an 'en' translation
|
||||||
available. The Javascript i18n view must return a NON empty language catalog
|
available. The JavaScript i18n view must return a NON empty language catalog
|
||||||
with the proper English translations. See #13726 for more details.
|
with the proper English translations. See #13726 for more details.
|
||||||
"""
|
"""
|
||||||
with self.settings(LANGUAGE_CODE='fr'), override('en-us'):
|
with self.settings(LANGUAGE_CODE='fr'), override('en-us'):
|
||||||
|
|
Loading…
Reference in New Issue