jQuery ajax requests containing multiple '?' get replaced with a
string similar to jQuery152330039032_1231231, this is because it
is processing a stringified data object as jsonp and thinks its a url.
workaround is to add contenttype
see https://github.com/jquery/jquery/issues/1799
This is required for when helpers include json-encoded variables as arguments.
As an example, imagine a template with content:
{{# str }} somekey, someidentifier, { "fullname": "{{ fullname }}" } {{/ str }}
If the fullname variable were to include the double-quote character (e.g.
John "Trevor" Doe) because of the way in which mustache renders content, it
would become:
{{# str }} somekey, someidentifier, { "fullname": "John "Trevor" Doe" } {{/ str }}
This results in an invalid JSON structure.
To work around this issue, the quote characters in the passed variable
must be escaped:
{{# str }} somekey, someidentifier, { "fullname": "John \"Trevor\" Doe" } {{/ str }}
Unfortunately, Mustache provides no way of doing so natively.
With this function, we can quote the text as appropriate:
{{# str }} somekey, someidentifier, { "fullname": {{# quote }}{{ fullname }}{{/ quote }} } {{/ str }}
This also handles the case where the quoted content includes the Mustache
delimeter ({{ or }}).
For example:
fullname = 'John "}}Trevor{{" Doe'
Ordinarily this would be rendered as:
{{# str }} somekey, someidentifier, { "fullname": "John "}}Trevor{{" Doe" } {{/ str }}
This rendering is both a JSON error, and also a mustache syntax error because of the mustache delimeters.
The quote helper also escapes these by wrapping them in change delimeter
tags:
{{# str }} somekey, someidentifier, { "fullname": "John "{{=<% %>=}}}}<%={{ }}=%>Trevor{{=<% %>=}}{{{{=<% %>=}}" Doe" } {{/ str }}
If mod has grades, then while upgrading
modgrade_type is disabled. This will not post
it with form and hence validation fails.
To avoid above problem, use ->currentgradetype
if modgrade_type is not set
Sync is now automatically triggered by add/update instance. We need
to manually trigger sync before each part of the test to clean up
role assignments from the previous test.