We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Editor templates broken in non-debug mode
Since switching to Django 1.8 in master, the [scripts section of the editor templates](https://github.com/translate/pootle/blob/master/pootle/templates/editor/_scripts.html) doesn't render when `DEBUG = False`.

I might be doing something wrong, but I tried removing any template customizations we have, also clearing out caches, trying different browsers, always with the same result. I can reproduce this locally and in our staging server.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pootle/apps/pootle_store/templatetags/store_tags.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright (C) Pootle contributors.
5 #
6 # This file is a part of the Pootle project. It is distributed under the GPL3
7 # or later license. See the LICENSE file for a copy of the license and the
8 # AUTHORS file for copyright and authorship information.
9 
10 import re
11 
12 from diff_match_patch import diff_match_patch
13 from translate.misc.multistring import multistring
14 from translate.storage.placeables import general
15 
16 from django import template
17 from django.core.exceptions import ObjectDoesNotExist
18 from django.template.defaultfilters import stringfilter
19 from django.template.loader import get_template
20 from django.utils.safestring import mark_safe
21 from django.utils.translation import ugettext as _
22 
23 from pootle_store.fields import list_empty
24 
25 
26 register = template.Library()
27 
28 
29 IMAGE_URL_RE = re.compile("(https?://[^\s]+\.(png|jpe?g|gif))", re.IGNORECASE)
30 
31 
32 @register.filter
33 def image_urls(text):
34     """Return a list of image URLs extracted from `text`."""
35     return map(lambda x: x[0], IMAGE_URL_RE.findall(text))
36 
37 
38 ESCAPE_RE = re.compile('<[^<]*?>|\\\\|\r\n|[\r\n\t&<>]')
39 
40 
41 def fancy_escape(text):
42     """Replace special chars with entities, and highlight XML tags and
43     whitespaces.
44     """
45     def replace(match):
46         escape_highlight = ('<span class="highlight-escape '
47                             'js-editor-copytext">%s</span>')
48         submap = {
49             '\r\n': (escape_highlight % '\\r\\n') + '<br/>\n',
50             '\r': (escape_highlight % '\\r') + '<br/>\n',
51             '\n': (escape_highlight % '\\n') + '<br/>\n',
52             '\t': (escape_highlight % '\\t'),
53             '&': '&amp;',
54             '<': '&lt;',
55             '>': '&gt;',
56             '\\': (escape_highlight % '\\\\'),
57         }
58         try:
59             return submap[match.group()]
60         except KeyError:
61             html_highlight = ('<span class="highlight-html '
62                               'js-editor-copytext">&lt;%s&gt;</span>')
63             return html_highlight % fancy_escape(match.group()[1:-1])
64 
65     return ESCAPE_RE.sub(replace, text)
66 
67 
68 WHITESPACE_RE = re.compile('^ +| +$|[\r\n\t] +| {2,}')
69 
70 
71 def fancy_spaces(text):
72     """Highlight spaces to make them easily visible."""
73     def replace(match):
74         fancy_space = '<span class="translation-space"> </span>'
75         if match.group().startswith(' '):
76             return fancy_space * len(match.group())
77         return match.group()[0] + fancy_space * (len(match.group()) - 1)
78     return WHITESPACE_RE.sub(replace, text)
79 
80 
81 PUNCTUATION_RE = general.PunctuationPlaceable().regex
82 
83 
84 def fancy_punctuation_chars(text):
85     """Wrap punctuation chars found in the ``text`` around tags."""
86     def replace(match):
87         fancy_special_char = ('<span class="highlight-punctuation '
88                               'js-editor-copytext">%s</span>')
89         return fancy_special_char % match.group()
90 
91     return PUNCTUATION_RE.sub(replace, text)
92 
93 
94 @register.filter
95 @stringfilter
96 def fancy_highlight(text):
97     return mark_safe(fancy_punctuation_chars(fancy_spaces(fancy_escape(text))))
98 
99 
100 def call_highlight(old, new):
101     """Calls diff highlighting code only if the target is set.
102     Otherwise, highlight as a normal unit.
103     """
104     if isinstance(old, multistring):
105         old_value = old.strings
106     else:
107         old_value = old
108 
109     if list_empty(old_value):
110         return fancy_highlight(new)
111 
112     return highlight_diffs(old, new)
113 
114 
115 differencer = diff_match_patch()
116 
117 
118 def highlight_diffs(old, new):
119     """Highlight the differences between old and new."""
120 
121     textdiff = u""  # to store the final result
122     removed = u""  # the removed text that we might still want to add
123     diff = differencer.diff_main(old, new)
124     differencer.diff_cleanupSemantic(diff)
125     for op, text in diff:
126         if op == 0:  # equality
127             if removed:
128                 textdiff += '<span class="diff-delete">%s</span>' % \
129                     fancy_escape(removed)
130                 removed = u""
131             textdiff += fancy_escape(text)
132         elif op == 1:  # insertion
133             if removed:
134                 # this is part of a substitution, not a plain insertion. We
135                 # will format this differently.
136                 textdiff += '<span class="diff-replace">%s</span>' % \
137                     fancy_escape(text)
138                 removed = u""
139             else:
140                 textdiff += '<span class="diff-insert">%s</span>' % \
141                     fancy_escape(text)
142         elif op == -1:  # deletion
143             removed = text
144     if removed:
145         textdiff += '<span class="diff-delete">%s</span>' % \
146             fancy_escape(removed)
147     return mark_safe(textdiff)
148 
149 
150 @register.filter('pluralize_source')
151 def pluralize_source(unit):
152     if not unit.hasplural():
153         return [(0, unit.source, None)]
154 
155     count = len(unit.source.strings)
156     if count == 1:
157         return [(0, unit.source.strings[0], "%s+%s" % (_('Singular'),
158                                                        _('Plural')))]
159 
160     if count == 2:
161         return [(0, unit.source.strings[0], _('Singular')),
162                 (1, unit.source.strings[1], _('Plural'))]
163 
164     forms = []
165     for i, source in enumerate(unit.source.strings):
166         forms.append((i, source, _('Plural Form %d', i)))
167     return forms
168 
169 
170 @register.filter('pluralize_target')
171 def pluralize_target(unit, nplurals=None):
172     if not unit.hasplural():
173         return [(0, unit.target, None)]
174 
175     if nplurals is None:
176         try:
177             nplurals = unit.store.translation_project.language.nplurals
178         except ObjectDoesNotExist:
179             pass
180     forms = []
181     if nplurals is None:
182         for i, target in enumerate(unit.target.strings):
183             forms.append((i, target, _('Plural Form %d', i)))
184     else:
185         for i in range(nplurals):
186             try:
187                 target = unit.target.strings[i]
188             except IndexError:
189                 target = ''
190             forms.append((i, target, _('Plural Form %d', i)))
191 
192     return forms
193 
194 
195 @register.filter('pluralize_diff_sugg')
196 def pluralize_diff_sugg(sugg):
197     unit = sugg.unit
198     if not unit.hasplural():
199         return [
200             (0, sugg.target, call_highlight(unit.target, sugg.target), None)
201         ]
202 
203     forms = []
204     for i, target in enumerate(sugg.target.strings):
205         if i < len(unit.target.strings):
206             sugg_text = unit.target.strings[i]
207         else:
208             sugg_text = ''
209 
210         forms.append((
211             i, target, call_highlight(sugg_text, target),
212             _('Plural Form %d', i)
213         ))
214 
215     return forms
216 
217 
218 @register.tag(name="include_raw")
219 def do_include_raw(parser, token):
220     """
221     Performs a template include without parsing the context, just dumps
222     the template in.
223     Source: http://djangosnippets.org/snippets/1684/
224     """
225     bits = token.split_contents()
226     if len(bits) != 2:
227         raise template.TemplateSyntaxError(
228             "%r tag takes one argument: the name of the template "
229             "to be included" % bits[0]
230         )
231 
232     template_name = bits[1]
233     if (template_name[0] in ('"', "'") and
234             template_name[-1] == template_name[0]):
235         template_name = template_name[1:-1]
236 
237     source, path = get_template(
238         template_name).origin.loader(template_name)
239 
240     return template.base.TextNode(source)
241
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pootle/apps/pootle_store/templatetags/store_tags.py b/pootle/apps/pootle_store/templatetags/store_tags.py
--- a/pootle/apps/pootle_store/templatetags/store_tags.py
+++ b/pootle/apps/pootle_store/templatetags/store_tags.py
@@ -234,7 +234,8 @@
             template_name[-1] == template_name[0]):
         template_name = template_name[1:-1]
 
-    source, path = get_template(
-        template_name).origin.loader(template_name)
-
-    return template.base.TextNode(source)
+    return template.base.TextNode(
+        u"\n".join(
+            [x.s
+             for x
+             in get_template(template_name).template.nodelist]))

{"golden_diff": "diff --git a/pootle/apps/pootle_store/templatetags/store_tags.py b/pootle/apps/pootle_store/templatetags/store_tags.py\n--- a/pootle/apps/pootle_store/templatetags/store_tags.py\n+++ b/pootle/apps/pootle_store/templatetags/store_tags.py\n@@ -234,7 +234,8 @@\n             template_name[-1] == template_name[0]):\n         template_name = template_name[1:-1]\n \n-    source, path = get_template(\n-        template_name).origin.loader(template_name)\n-\n-    return template.base.TextNode(source)\n+    return template.base.TextNode(\n+        u\"\\n\".join(\n+            [x.s\n+             for x\n+             in get_template(template_name).template.nodelist]))\n", "issue": "Editor templates broken in non-debug mode\nSince switching to Django 1.8 in master, the [scripts section of the editor templates](https://github.com/translate/pootle/blob/master/pootle/templates/editor/_scripts.html) doesn't render when `DEBUG = False`.\n\nI might be doing something wrong, but I tried removing any template customizations we have, also clearing out caches, trying different browsers, always with the same result. I can reproduce this locally and in our staging server.\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport re\n\nfrom diff_match_patch import diff_match_patch\nfrom translate.misc.multistring import multistring\nfrom translate.storage.placeables import general\n\nfrom django import template\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.template.defaultfilters import stringfilter\nfrom django.template.loader import get_template\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext as _\n\nfrom pootle_store.fields import list_empty\n\n\nregister = template.Library()\n\n\nIMAGE_URL_RE = re.compile(\"(https?://[^\\s]+\\.(png|jpe?g|gif))\", re.IGNORECASE)\n\n\n@register.filter\ndef image_urls(text):\n    \"\"\"Return a list of image URLs extracted from `text`.\"\"\"\n    return map(lambda x: x[0], IMAGE_URL_RE.findall(text))\n\n\nESCAPE_RE = re.compile('<[^<]*?>|\\\\\\\\|\\r\\n|[\\r\\n\\t&<>]')\n\n\ndef fancy_escape(text):\n    \"\"\"Replace special chars with entities, and highlight XML tags and\n    whitespaces.\n    \"\"\"\n    def replace(match):\n        escape_highlight = ('<span class=\"highlight-escape '\n                            'js-editor-copytext\">%s</span>')\n        submap = {\n            '\\r\\n': (escape_highlight % '\\\\r\\\\n') + '<br/>\\n',\n            '\\r': (escape_highlight % '\\\\r') + '<br/>\\n',\n            '\\n': (escape_highlight % '\\\\n') + '<br/>\\n',\n            '\\t': (escape_highlight % '\\\\t'),\n            '&': '&amp;',\n            '<': '&lt;',\n            '>': '&gt;',\n            '\\\\': (escape_highlight % '\\\\\\\\'),\n        }\n        try:\n            return submap[match.group()]\n        except KeyError:\n            html_highlight = ('<span class=\"highlight-html '\n                              'js-editor-copytext\">&lt;%s&gt;</span>')\n            return html_highlight % fancy_escape(match.group()[1:-1])\n\n    return ESCAPE_RE.sub(replace, text)\n\n\nWHITESPACE_RE = re.compile('^ +| +$|[\\r\\n\\t] +| {2,}')\n\n\ndef fancy_spaces(text):\n    \"\"\"Highlight spaces to make them easily visible.\"\"\"\n    def replace(match):\n        fancy_space = '<span class=\"translation-space\"> </span>'\n        if match.group().startswith(' '):\n            return fancy_space * len(match.group())\n        return match.group()[0] + fancy_space * (len(match.group()) - 1)\n    return WHITESPACE_RE.sub(replace, text)\n\n\nPUNCTUATION_RE = general.PunctuationPlaceable().regex\n\n\ndef fancy_punctuation_chars(text):\n    \"\"\"Wrap punctuation chars found in the ``text`` around tags.\"\"\"\n    def replace(match):\n        fancy_special_char = ('<span class=\"highlight-punctuation '\n                              'js-editor-copytext\">%s</span>')\n        return fancy_special_char % match.group()\n\n    return PUNCTUATION_RE.sub(replace, text)\n\n\n@register.filter\n@stringfilter\ndef fancy_highlight(text):\n    return mark_safe(fancy_punctuation_chars(fancy_spaces(fancy_escape(text))))\n\n\ndef call_highlight(old, new):\n    \"\"\"Calls diff highlighting code only if the target is set.\n    Otherwise, highlight as a normal unit.\n    \"\"\"\n    if isinstance(old, multistring):\n        old_value = old.strings\n    else:\n        old_value = old\n\n    if list_empty(old_value):\n        return fancy_highlight(new)\n\n    return highlight_diffs(old, new)\n\n\ndifferencer = diff_match_patch()\n\n\ndef highlight_diffs(old, new):\n    \"\"\"Highlight the differences between old and new.\"\"\"\n\n    textdiff = u\"\"  # to store the final result\n    removed = u\"\"  # the removed text that we might still want to add\n    diff = differencer.diff_main(old, new)\n    differencer.diff_cleanupSemantic(diff)\n    for op, text in diff:\n        if op == 0:  # equality\n            if removed:\n                textdiff += '<span class=\"diff-delete\">%s</span>' % \\\n                    fancy_escape(removed)\n                removed = u\"\"\n            textdiff += fancy_escape(text)\n        elif op == 1:  # insertion\n            if removed:\n                # this is part of a substitution, not a plain insertion. We\n                # will format this differently.\n                textdiff += '<span class=\"diff-replace\">%s</span>' % \\\n                    fancy_escape(text)\n                removed = u\"\"\n            else:\n                textdiff += '<span class=\"diff-insert\">%s</span>' % \\\n                    fancy_escape(text)\n        elif op == -1:  # deletion\n            removed = text\n    if removed:\n        textdiff += '<span class=\"diff-delete\">%s</span>' % \\\n            fancy_escape(removed)\n    return mark_safe(textdiff)\n\n\n@register.filter('pluralize_source')\ndef pluralize_source(unit):\n    if not unit.hasplural():\n        return [(0, unit.source, None)]\n\n    count = len(unit.source.strings)\n    if count == 1:\n        return [(0, unit.source.strings[0], \"%s+%s\" % (_('Singular'),\n                                                       _('Plural')))]\n\n    if count == 2:\n        return [(0, unit.source.strings[0], _('Singular')),\n                (1, unit.source.strings[1], _('Plural'))]\n\n    forms = []\n    for i, source in enumerate(unit.source.strings):\n        forms.append((i, source, _('Plural Form %d', i)))\n    return forms\n\n\n@register.filter('pluralize_target')\ndef pluralize_target(unit, nplurals=None):\n    if not unit.hasplural():\n        return [(0, unit.target, None)]\n\n    if nplurals is None:\n        try:\n            nplurals = unit.store.translation_project.language.nplurals\n        except ObjectDoesNotExist:\n            pass\n    forms = []\n    if nplurals is None:\n        for i, target in enumerate(unit.target.strings):\n            forms.append((i, target, _('Plural Form %d', i)))\n    else:\n        for i in range(nplurals):\n            try:\n                target = unit.target.strings[i]\n            except IndexError:\n                target = ''\n            forms.append((i, target, _('Plural Form %d', i)))\n\n    return forms\n\n\n@register.filter('pluralize_diff_sugg')\ndef pluralize_diff_sugg(sugg):\n    unit = sugg.unit\n    if not unit.hasplural():\n        return [\n            (0, sugg.target, call_highlight(unit.target, sugg.target), None)\n        ]\n\n    forms = []\n    for i, target in enumerate(sugg.target.strings):\n        if i < len(unit.target.strings):\n            sugg_text = unit.target.strings[i]\n        else:\n            sugg_text = ''\n\n        forms.append((\n            i, target, call_highlight(sugg_text, target),\n            _('Plural Form %d', i)\n        ))\n\n    return forms\n\n\n@register.tag(name=\"include_raw\")\ndef do_include_raw(parser, token):\n    \"\"\"\n    Performs a template include without parsing the context, just dumps\n    the template in.\n    Source: http://djangosnippets.org/snippets/1684/\n    \"\"\"\n    bits = token.split_contents()\n    if len(bits) != 2:\n        raise template.TemplateSyntaxError(\n            \"%r tag takes one argument: the name of the template \"\n            \"to be included\" % bits[0]\n        )\n\n    template_name = bits[1]\n    if (template_name[0] in ('\"', \"'\") and\n            template_name[-1] == template_name[0]):\n        template_name = template_name[1:-1]\n\n    source, path = get_template(\n        template_name).origin.loader(template_name)\n\n    return template.base.TextNode(source)\n", "path": "pootle/apps/pootle_store/templatetags/store_tags.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nimport re\n\nfrom diff_match_patch import diff_match_patch\nfrom translate.misc.multistring import multistring\nfrom translate.storage.placeables import general\n\nfrom django import template\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom django.template.defaultfilters import stringfilter\nfrom django.template.loader import get_template\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext as _\n\nfrom pootle_store.fields import list_empty\n\n\nregister = template.Library()\n\n\nIMAGE_URL_RE = re.compile(\"(https?://[^\\s]+\\.(png|jpe?g|gif))\", re.IGNORECASE)\n\n\n@register.filter\ndef image_urls(text):\n    \"\"\"Return a list of image URLs extracted from `text`.\"\"\"\n    return map(lambda x: x[0], IMAGE_URL_RE.findall(text))\n\n\nESCAPE_RE = re.compile('<[^<]*?>|\\\\\\\\|\\r\\n|[\\r\\n\\t&<>]')\n\n\ndef fancy_escape(text):\n    \"\"\"Replace special chars with entities, and highlight XML tags and\n    whitespaces.\n    \"\"\"\n    def replace(match):\n        escape_highlight = ('<span class=\"highlight-escape '\n                            'js-editor-copytext\">%s</span>')\n        submap = {\n            '\\r\\n': (escape_highlight % '\\\\r\\\\n') + '<br/>\\n',\n            '\\r': (escape_highlight % '\\\\r') + '<br/>\\n',\n            '\\n': (escape_highlight % '\\\\n') + '<br/>\\n',\n            '\\t': (escape_highlight % '\\\\t'),\n            '&': '&amp;',\n            '<': '&lt;',\n            '>': '&gt;',\n            '\\\\': (escape_highlight % '\\\\\\\\'),\n        }\n        try:\n            return submap[match.group()]\n        except KeyError:\n            html_highlight = ('<span class=\"highlight-html '\n                              'js-editor-copytext\">&lt;%s&gt;</span>')\n            return html_highlight % fancy_escape(match.group()[1:-1])\n\n    return ESCAPE_RE.sub(replace, text)\n\n\nWHITESPACE_RE = re.compile('^ +| +$|[\\r\\n\\t] +| {2,}')\n\n\ndef fancy_spaces(text):\n    \"\"\"Highlight spaces to make them easily visible.\"\"\"\n    def replace(match):\n        fancy_space = '<span class=\"translation-space\"> </span>'\n        if match.group().startswith(' '):\n            return fancy_space * len(match.group())\n        return match.group()[0] + fancy_space * (len(match.group()) - 1)\n    return WHITESPACE_RE.sub(replace, text)\n\n\nPUNCTUATION_RE = general.PunctuationPlaceable().regex\n\n\ndef fancy_punctuation_chars(text):\n    \"\"\"Wrap punctuation chars found in the ``text`` around tags.\"\"\"\n    def replace(match):\n        fancy_special_char = ('<span class=\"highlight-punctuation '\n                              'js-editor-copytext\">%s</span>')\n        return fancy_special_char % match.group()\n\n    return PUNCTUATION_RE.sub(replace, text)\n\n\n@register.filter\n@stringfilter\ndef fancy_highlight(text):\n    return mark_safe(fancy_punctuation_chars(fancy_spaces(fancy_escape(text))))\n\n\ndef call_highlight(old, new):\n    \"\"\"Calls diff highlighting code only if the target is set.\n    Otherwise, highlight as a normal unit.\n    \"\"\"\n    if isinstance(old, multistring):\n        old_value = old.strings\n    else:\n        old_value = old\n\n    if list_empty(old_value):\n        return fancy_highlight(new)\n\n    return highlight_diffs(old, new)\n\n\ndifferencer = diff_match_patch()\n\n\ndef highlight_diffs(old, new):\n    \"\"\"Highlight the differences between old and new.\"\"\"\n\n    textdiff = u\"\"  # to store the final result\n    removed = u\"\"  # the removed text that we might still want to add\n    diff = differencer.diff_main(old, new)\n    differencer.diff_cleanupSemantic(diff)\n    for op, text in diff:\n        if op == 0:  # equality\n            if removed:\n                textdiff += '<span class=\"diff-delete\">%s</span>' % \\\n                    fancy_escape(removed)\n                removed = u\"\"\n            textdiff += fancy_escape(text)\n        elif op == 1:  # insertion\n            if removed:\n                # this is part of a substitution, not a plain insertion. We\n                # will format this differently.\n                textdiff += '<span class=\"diff-replace\">%s</span>' % \\\n                    fancy_escape(text)\n                removed = u\"\"\n            else:\n                textdiff += '<span class=\"diff-insert\">%s</span>' % \\\n                    fancy_escape(text)\n        elif op == -1:  # deletion\n            removed = text\n    if removed:\n        textdiff += '<span class=\"diff-delete\">%s</span>' % \\\n            fancy_escape(removed)\n    return mark_safe(textdiff)\n\n\n@register.filter('pluralize_source')\ndef pluralize_source(unit):\n    if not unit.hasplural():\n        return [(0, unit.source, None)]\n\n    count = len(unit.source.strings)\n    if count == 1:\n        return [(0, unit.source.strings[0], \"%s+%s\" % (_('Singular'),\n                                                       _('Plural')))]\n\n    if count == 2:\n        return [(0, unit.source.strings[0], _('Singular')),\n                (1, unit.source.strings[1], _('Plural'))]\n\n    forms = []\n    for i, source in enumerate(unit.source.strings):\n        forms.append((i, source, _('Plural Form %d', i)))\n    return forms\n\n\n@register.filter('pluralize_target')\ndef pluralize_target(unit, nplurals=None):\n    if not unit.hasplural():\n        return [(0, unit.target, None)]\n\n    if nplurals is None:\n        try:\n            nplurals = unit.store.translation_project.language.nplurals\n        except ObjectDoesNotExist:\n            pass\n    forms = []\n    if nplurals is None:\n        for i, target in enumerate(unit.target.strings):\n            forms.append((i, target, _('Plural Form %d', i)))\n    else:\n        for i in range(nplurals):\n            try:\n                target = unit.target.strings[i]\n            except IndexError:\n                target = ''\n            forms.append((i, target, _('Plural Form %d', i)))\n\n    return forms\n\n\n@register.filter('pluralize_diff_sugg')\ndef pluralize_diff_sugg(sugg):\n    unit = sugg.unit\n    if not unit.hasplural():\n        return [\n            (0, sugg.target, call_highlight(unit.target, sugg.target), None)\n        ]\n\n    forms = []\n    for i, target in enumerate(sugg.target.strings):\n        if i < len(unit.target.strings):\n            sugg_text = unit.target.strings[i]\n        else:\n            sugg_text = ''\n\n        forms.append((\n            i, target, call_highlight(sugg_text, target),\n            _('Plural Form %d', i)\n        ))\n\n    return forms\n\n\n@register.tag(name=\"include_raw\")\ndef do_include_raw(parser, token):\n    \"\"\"\n    Performs a template include without parsing the context, just dumps\n    the template in.\n    Source: http://djangosnippets.org/snippets/1684/\n    \"\"\"\n    bits = token.split_contents()\n    if len(bits) != 2:\n        raise template.TemplateSyntaxError(\n            \"%r tag takes one argument: the name of the template \"\n            \"to be included\" % bits[0]\n        )\n\n    template_name = bits[1]\n    if (template_name[0] in ('\"', \"'\") and\n            template_name[-1] == template_name[0]):\n        template_name = template_name[1:-1]\n\n    return template.base.TextNode(\n        u\"\\n\".join(\n            [x.s\n             for x\n             in get_template(template_name).template.nodelist]))\n", "path": "pootle/apps/pootle_store/templatetags/store_tags.py"}]}