We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Confusing sentence in permissions view
There is a permission called "Can review translations" that confused me as I thought that there are also reviewers beside suggesters and translators! Hopefully you fix it so that it lands in 2.7.0.


--- 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/core/initdb.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 
11 from django.contrib.auth import get_user_model
12 from django.contrib.auth.models import Permission
13 from django.contrib.contenttypes.models import ContentType
14 from django.utils.translation import ugettext_noop as _
15 
16 from pootle.core.models import Revision
17 from pootle_app.models import Directory
18 from pootle_app.models.permissions import PermissionSet, get_pootle_permission
19 from pootle_language.models import Language
20 from pootle_project.models import Project
21 from staticpages.models import StaticPage as Announcement
22 
23 
24 def initdb():
25     """Populate the database with default initial data.
26 
27     This creates the default database to get a working Pootle installation.
28     """
29     create_revision()
30     create_essential_users()
31     create_root_directories()
32     create_template_languages()
33     create_terminology_project()
34     create_pootle_permissions()
35     create_pootle_permission_sets()
36 
37     create_default_projects()
38     create_default_languages()
39     create_default_admin()
40 
41 
42 def create_revision():
43     Revision.initialize()
44 
45 
46 def create_essential_users():
47     """Create the 'default' and 'nobody' User instances.
48 
49     These users are required for Pootle's permission system.
50     """
51     User = get_user_model()
52 
53     # The nobody user is used to represent an anonymous user in cases where
54     # we need to associate model information with such a user. An example is
55     # in the permission system: we need a way to store rights for anonymous
56     # users; thus we use the nobody user.
57     criteria = {
58         'username': u"nobody",
59         'full_name': u"any anonymous user",
60         'is_active': True,
61     }
62     nobody, created = User.objects.get_or_create(**criteria)
63     if created:
64         nobody.set_unusable_password()
65         nobody.save()
66 
67     # The 'default' user represents any valid, non-anonymous user and is used
68     # to associate information any such user. An example is in the permission
69     # system: we need a way to store default rights for users. We use the
70     # 'default' user for this.
71     #
72     # In a future version of Pootle we should think about using Django's
73     # groups to do better permissions handling.
74     criteria = {
75         'username': u"default",
76         'full_name': u"any authenticated user",
77         'is_active': True,
78     }
79     default, created = User.objects.get_or_create(**criteria)
80     if created:
81         default.set_unusable_password()
82         default.save()
83 
84     # The system user represents a system, and is used to
85     # associate updates done by bulk commands as update_stores.
86     criteria = {
87         'username': u"system",
88         'full_name': u"system user",
89         'is_active': True,
90     }
91     system, created = User.objects.get_or_create(**criteria)
92     if created:
93         system.set_unusable_password()
94         system.save()
95 
96 
97 def create_pootle_permissions():
98     """Create Pootle's directory level permissions."""
99 
100     args = {
101         'app_label': "pootle_app",
102         'model': "directory",
103     }
104     pootle_content_type, created = ContentType.objects.get_or_create(**args)
105     pootle_content_type.name = 'pootle'
106     pootle_content_type.save()
107 
108     # Create the permissions.
109     permissions = [
110         {
111             'name': _("Can access a project"),
112             'codename': "view",
113         },
114         {
115             'name': _("Cannot access a project"),
116             'codename': "hide",
117         },
118         {
119             'name': _("Can make a suggestion for a translation"),
120             'codename': "suggest",
121         },
122         {
123             'name': _("Can submit a translation"),
124             'codename': "translate",
125         },
126         {
127             'name': _("Can review translations"),
128             'codename': "review",
129         },
130         {
131             'name': _("Can administrate a translation project"),
132             'codename': "administrate",
133         },
134     ]
135 
136     criteria = {
137         'content_type': pootle_content_type,
138     }
139 
140     for permission in permissions:
141         criteria.update(permission)
142         obj, created = Permission.objects.get_or_create(**criteria)
143 
144 
145 def create_pootle_permission_sets():
146     """Create the default permission set for the 'nobody' and 'default' users.
147 
148     'nobody' is the anonymous (non-logged in) user, and 'default' is the logged
149     in user.
150     """
151     User = get_user_model()
152 
153     nobody = User.objects.get(username='nobody')
154     default = User.objects.get(username='default')
155 
156     view = get_pootle_permission('view')
157     suggest = get_pootle_permission('suggest')
158     translate = get_pootle_permission('translate')
159 
160     # Default permissions for tree root.
161     criteria = {
162         'user': nobody,
163         'directory': Directory.objects.root,
164     }
165     permission_set, created = PermissionSet.objects.get_or_create(**criteria)
166     if created:
167         permission_set.positive_permissions = [view, suggest]
168         permission_set.save()
169 
170     criteria['user'] = default
171     permission_set, created = PermissionSet.objects.get_or_create(**criteria)
172     if created:
173         permission_set.positive_permissions = [view, suggest, translate]
174         permission_set.save()
175 
176     # Default permissions for templates language.
177     # Override with no permissions for templates language.
178     criteria = {
179         'user': nobody,
180         'directory': Directory.objects.get(pootle_path="/templates/"),
181     }
182     permission_set, created = PermissionSet.objects.get_or_create(**criteria)
183     if created:
184         permission_set.positive_permissions = []
185         permission_set.save()
186 
187     criteria['user'] = default
188     permission_set, created = PermissionSet.objects.get_or_create(**criteria)
189     if created:
190         permission_set.positive_permissions = []
191         permission_set.save()
192 
193 
194 def require_english():
195     """Create the English Language item."""
196     criteria = {
197         'code': "en",
198         'fullname': u"English",
199         'nplurals': 2,
200         'pluralequation': "(n != 1)",
201     }
202     en, created = Language.objects.get_or_create(**criteria)
203     return en
204 
205 
206 def create_root_directories():
207     """Create the root Directory items."""
208     root, created = Directory.objects.get_or_create(name='')
209     projects, created = Directory.objects.get_or_create(name='projects',
210                                                         parent=root)
211 
212 
213 def create_template_languages():
214     """Create the 'templates' and English languages.
215 
216     The 'templates' language is used to give users access to the untranslated
217     template files.
218     """
219     templates, created = Language.objects.get_or_create(code="templates",
220                                                         fullname=u'Templates')
221     require_english()
222 
223 
224 def create_terminology_project():
225     """Create the terminology project.
226 
227     The terminology project is used to display terminology suggestions while
228     translating.
229     """
230     criteria = {
231         'code': "terminology",
232         'fullname': u"Terminology",
233         'source_language': require_english(),
234         'checkstyle': "terminology",
235     }
236     terminology, created = Project.objects.get_or_create(**criteria)
237 
238 
239 def create_default_projects():
240     """Create the default projects that we host.
241 
242     You might want to add your projects here, although you can also add things
243     through the web interface later.
244     """
245     from pootle_project.models import Project
246 
247     en = require_english()
248 
249     criteria = {
250         'code': u"tutorial",
251         'source_language': en,
252         'fullname': u"Tutorial",
253         'checkstyle': "standard",
254         'localfiletype': "po",
255         'treestyle': "auto",
256     }
257     tutorial = Project(**criteria)
258     tutorial.save()
259 
260     criteria = {
261         'active': True,
262         'title': "Project instructions",
263         'body': ('<div dir="ltr" lang="en">Tutorial project where users can '
264                  'play with Pootle and learn more about translation and '
265                  'localisation.<br />For more help on localisation, visit the '
266                  '<a href="http://docs.translatehouse.org/projects/'
267                  'localization-guide/en/latest/guide/start.html">localisation '
268                  'guide</a>.</div>'),
269         'virtual_path': "announcements/projects/"+tutorial.code,
270     }
271     ann = Announcement(**criteria)
272     ann.save()
273 
274 
275 def create_default_languages():
276     """Create the default languages."""
277     from translate.lang import data, factory
278 
279     from pootle_language.models import Language
280 
281     # import languages from toolkit
282     for code in data.languages.keys():
283         try:
284             tk_lang = factory.getlanguage(code)
285             criteria = {
286                 'code': code,
287                 'fullname': tk_lang.fullname,
288                 'nplurals': tk_lang.nplurals,
289                 'pluralequation': tk_lang.pluralequation,
290             }
291             try:
292                 criteria['specialchars'] = tk_lang.specialchars
293             except AttributeError:
294                 pass
295             lang, created = Language.objects.get_or_create(**criteria)
296         except:
297             pass
298 
299 
300 def create_default_admin():
301     """Create the default admin user for Pootle.
302 
303     You definitely want to change the admin account so that your default
304     install is not accessible with the default credentials. The users 'noboby'
305     and 'default' should be left as is.
306     """
307     User = get_user_model()
308 
309     criteria = {
310         'username': u"admin",
311         'full_name': u"Administrator",
312         'is_active': True,
313         'is_superuser': True,
314     }
315     admin = User(**criteria)
316     admin.set_password("admin")
317     admin.save()
318
```
--- 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/core/initdb.py b/pootle/core/initdb.py
--- a/pootle/core/initdb.py
+++ b/pootle/core/initdb.py
@@ -124,7 +124,7 @@
             'codename': "translate",
         },
         {
-            'name': _("Can review translations"),
+            'name': _("Can review suggestions"),
             'codename': "review",
         },
         {

{"golden_diff": "diff --git a/pootle/core/initdb.py b/pootle/core/initdb.py\n--- a/pootle/core/initdb.py\n+++ b/pootle/core/initdb.py\n@@ -124,7 +124,7 @@\n             'codename': \"translate\",\n         },\n         {\n-            'name': _(\"Can review translations\"),\n+            'name': _(\"Can review suggestions\"),\n             'codename': \"review\",\n         },\n         {\n", "issue": "Confusing sentence in permissions view\nThere is a permission called \"Can review translations\" that confused me as I thought that there are also reviewers beside suggesters and translators! Hopefully you fix it so that it lands in 2.7.0.\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\n\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.auth.models import Permission\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.utils.translation import ugettext_noop as _\n\nfrom pootle.core.models import Revision\nfrom pootle_app.models import Directory\nfrom pootle_app.models.permissions import PermissionSet, get_pootle_permission\nfrom pootle_language.models import Language\nfrom pootle_project.models import Project\nfrom staticpages.models import StaticPage as Announcement\n\n\ndef initdb():\n    \"\"\"Populate the database with default initial data.\n\n    This creates the default database to get a working Pootle installation.\n    \"\"\"\n    create_revision()\n    create_essential_users()\n    create_root_directories()\n    create_template_languages()\n    create_terminology_project()\n    create_pootle_permissions()\n    create_pootle_permission_sets()\n\n    create_default_projects()\n    create_default_languages()\n    create_default_admin()\n\n\ndef create_revision():\n    Revision.initialize()\n\n\ndef create_essential_users():\n    \"\"\"Create the 'default' and 'nobody' User instances.\n\n    These users are required for Pootle's permission system.\n    \"\"\"\n    User = get_user_model()\n\n    # The nobody user is used to represent an anonymous user in cases where\n    # we need to associate model information with such a user. An example is\n    # in the permission system: we need a way to store rights for anonymous\n    # users; thus we use the nobody user.\n    criteria = {\n        'username': u\"nobody\",\n        'full_name': u\"any anonymous user\",\n        'is_active': True,\n    }\n    nobody, created = User.objects.get_or_create(**criteria)\n    if created:\n        nobody.set_unusable_password()\n        nobody.save()\n\n    # The 'default' user represents any valid, non-anonymous user and is used\n    # to associate information any such user. An example is in the permission\n    # system: we need a way to store default rights for users. We use the\n    # 'default' user for this.\n    #\n    # In a future version of Pootle we should think about using Django's\n    # groups to do better permissions handling.\n    criteria = {\n        'username': u\"default\",\n        'full_name': u\"any authenticated user\",\n        'is_active': True,\n    }\n    default, created = User.objects.get_or_create(**criteria)\n    if created:\n        default.set_unusable_password()\n        default.save()\n\n    # The system user represents a system, and is used to\n    # associate updates done by bulk commands as update_stores.\n    criteria = {\n        'username': u\"system\",\n        'full_name': u\"system user\",\n        'is_active': True,\n    }\n    system, created = User.objects.get_or_create(**criteria)\n    if created:\n        system.set_unusable_password()\n        system.save()\n\n\ndef create_pootle_permissions():\n    \"\"\"Create Pootle's directory level permissions.\"\"\"\n\n    args = {\n        'app_label': \"pootle_app\",\n        'model': \"directory\",\n    }\n    pootle_content_type, created = ContentType.objects.get_or_create(**args)\n    pootle_content_type.name = 'pootle'\n    pootle_content_type.save()\n\n    # Create the permissions.\n    permissions = [\n        {\n            'name': _(\"Can access a project\"),\n            'codename': \"view\",\n        },\n        {\n            'name': _(\"Cannot access a project\"),\n            'codename': \"hide\",\n        },\n        {\n            'name': _(\"Can make a suggestion for a translation\"),\n            'codename': \"suggest\",\n        },\n        {\n            'name': _(\"Can submit a translation\"),\n            'codename': \"translate\",\n        },\n        {\n            'name': _(\"Can review translations\"),\n            'codename': \"review\",\n        },\n        {\n            'name': _(\"Can administrate a translation project\"),\n            'codename': \"administrate\",\n        },\n    ]\n\n    criteria = {\n        'content_type': pootle_content_type,\n    }\n\n    for permission in permissions:\n        criteria.update(permission)\n        obj, created = Permission.objects.get_or_create(**criteria)\n\n\ndef create_pootle_permission_sets():\n    \"\"\"Create the default permission set for the 'nobody' and 'default' users.\n\n    'nobody' is the anonymous (non-logged in) user, and 'default' is the logged\n    in user.\n    \"\"\"\n    User = get_user_model()\n\n    nobody = User.objects.get(username='nobody')\n    default = User.objects.get(username='default')\n\n    view = get_pootle_permission('view')\n    suggest = get_pootle_permission('suggest')\n    translate = get_pootle_permission('translate')\n\n    # Default permissions for tree root.\n    criteria = {\n        'user': nobody,\n        'directory': Directory.objects.root,\n    }\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = [view, suggest]\n        permission_set.save()\n\n    criteria['user'] = default\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = [view, suggest, translate]\n        permission_set.save()\n\n    # Default permissions for templates language.\n    # Override with no permissions for templates language.\n    criteria = {\n        'user': nobody,\n        'directory': Directory.objects.get(pootle_path=\"/templates/\"),\n    }\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = []\n        permission_set.save()\n\n    criteria['user'] = default\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = []\n        permission_set.save()\n\n\ndef require_english():\n    \"\"\"Create the English Language item.\"\"\"\n    criteria = {\n        'code': \"en\",\n        'fullname': u\"English\",\n        'nplurals': 2,\n        'pluralequation': \"(n != 1)\",\n    }\n    en, created = Language.objects.get_or_create(**criteria)\n    return en\n\n\ndef create_root_directories():\n    \"\"\"Create the root Directory items.\"\"\"\n    root, created = Directory.objects.get_or_create(name='')\n    projects, created = Directory.objects.get_or_create(name='projects',\n                                                        parent=root)\n\n\ndef create_template_languages():\n    \"\"\"Create the 'templates' and English languages.\n\n    The 'templates' language is used to give users access to the untranslated\n    template files.\n    \"\"\"\n    templates, created = Language.objects.get_or_create(code=\"templates\",\n                                                        fullname=u'Templates')\n    require_english()\n\n\ndef create_terminology_project():\n    \"\"\"Create the terminology project.\n\n    The terminology project is used to display terminology suggestions while\n    translating.\n    \"\"\"\n    criteria = {\n        'code': \"terminology\",\n        'fullname': u\"Terminology\",\n        'source_language': require_english(),\n        'checkstyle': \"terminology\",\n    }\n    terminology, created = Project.objects.get_or_create(**criteria)\n\n\ndef create_default_projects():\n    \"\"\"Create the default projects that we host.\n\n    You might want to add your projects here, although you can also add things\n    through the web interface later.\n    \"\"\"\n    from pootle_project.models import Project\n\n    en = require_english()\n\n    criteria = {\n        'code': u\"tutorial\",\n        'source_language': en,\n        'fullname': u\"Tutorial\",\n        'checkstyle': \"standard\",\n        'localfiletype': \"po\",\n        'treestyle': \"auto\",\n    }\n    tutorial = Project(**criteria)\n    tutorial.save()\n\n    criteria = {\n        'active': True,\n        'title': \"Project instructions\",\n        'body': ('<div dir=\"ltr\" lang=\"en\">Tutorial project where users can '\n                 'play with Pootle and learn more about translation and '\n                 'localisation.<br />For more help on localisation, visit the '\n                 '<a href=\"http://docs.translatehouse.org/projects/'\n                 'localization-guide/en/latest/guide/start.html\">localisation '\n                 'guide</a>.</div>'),\n        'virtual_path': \"announcements/projects/\"+tutorial.code,\n    }\n    ann = Announcement(**criteria)\n    ann.save()\n\n\ndef create_default_languages():\n    \"\"\"Create the default languages.\"\"\"\n    from translate.lang import data, factory\n\n    from pootle_language.models import Language\n\n    # import languages from toolkit\n    for code in data.languages.keys():\n        try:\n            tk_lang = factory.getlanguage(code)\n            criteria = {\n                'code': code,\n                'fullname': tk_lang.fullname,\n                'nplurals': tk_lang.nplurals,\n                'pluralequation': tk_lang.pluralequation,\n            }\n            try:\n                criteria['specialchars'] = tk_lang.specialchars\n            except AttributeError:\n                pass\n            lang, created = Language.objects.get_or_create(**criteria)\n        except:\n            pass\n\n\ndef create_default_admin():\n    \"\"\"Create the default admin user for Pootle.\n\n    You definitely want to change the admin account so that your default\n    install is not accessible with the default credentials. The users 'noboby'\n    and 'default' should be left as is.\n    \"\"\"\n    User = get_user_model()\n\n    criteria = {\n        'username': u\"admin\",\n        'full_name': u\"Administrator\",\n        'is_active': True,\n        'is_superuser': True,\n    }\n    admin = User(**criteria)\n    admin.set_password(\"admin\")\n    admin.save()\n", "path": "pootle/core/initdb.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\n\nfrom django.contrib.auth import get_user_model\nfrom django.contrib.auth.models import Permission\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.utils.translation import ugettext_noop as _\n\nfrom pootle.core.models import Revision\nfrom pootle_app.models import Directory\nfrom pootle_app.models.permissions import PermissionSet, get_pootle_permission\nfrom pootle_language.models import Language\nfrom pootle_project.models import Project\nfrom staticpages.models import StaticPage as Announcement\n\n\ndef initdb():\n    \"\"\"Populate the database with default initial data.\n\n    This creates the default database to get a working Pootle installation.\n    \"\"\"\n    create_revision()\n    create_essential_users()\n    create_root_directories()\n    create_template_languages()\n    create_terminology_project()\n    create_pootle_permissions()\n    create_pootle_permission_sets()\n\n    create_default_projects()\n    create_default_languages()\n    create_default_admin()\n\n\ndef create_revision():\n    Revision.initialize()\n\n\ndef create_essential_users():\n    \"\"\"Create the 'default' and 'nobody' User instances.\n\n    These users are required for Pootle's permission system.\n    \"\"\"\n    User = get_user_model()\n\n    # The nobody user is used to represent an anonymous user in cases where\n    # we need to associate model information with such a user. An example is\n    # in the permission system: we need a way to store rights for anonymous\n    # users; thus we use the nobody user.\n    criteria = {\n        'username': u\"nobody\",\n        'full_name': u\"any anonymous user\",\n        'is_active': True,\n    }\n    nobody, created = User.objects.get_or_create(**criteria)\n    if created:\n        nobody.set_unusable_password()\n        nobody.save()\n\n    # The 'default' user represents any valid, non-anonymous user and is used\n    # to associate information any such user. An example is in the permission\n    # system: we need a way to store default rights for users. We use the\n    # 'default' user for this.\n    #\n    # In a future version of Pootle we should think about using Django's\n    # groups to do better permissions handling.\n    criteria = {\n        'username': u\"default\",\n        'full_name': u\"any authenticated user\",\n        'is_active': True,\n    }\n    default, created = User.objects.get_or_create(**criteria)\n    if created:\n        default.set_unusable_password()\n        default.save()\n\n    # The system user represents a system, and is used to\n    # associate updates done by bulk commands as update_stores.\n    criteria = {\n        'username': u\"system\",\n        'full_name': u\"system user\",\n        'is_active': True,\n    }\n    system, created = User.objects.get_or_create(**criteria)\n    if created:\n        system.set_unusable_password()\n        system.save()\n\n\ndef create_pootle_permissions():\n    \"\"\"Create Pootle's directory level permissions.\"\"\"\n\n    args = {\n        'app_label': \"pootle_app\",\n        'model': \"directory\",\n    }\n    pootle_content_type, created = ContentType.objects.get_or_create(**args)\n    pootle_content_type.name = 'pootle'\n    pootle_content_type.save()\n\n    # Create the permissions.\n    permissions = [\n        {\n            'name': _(\"Can access a project\"),\n            'codename': \"view\",\n        },\n        {\n            'name': _(\"Cannot access a project\"),\n            'codename': \"hide\",\n        },\n        {\n            'name': _(\"Can make a suggestion for a translation\"),\n            'codename': \"suggest\",\n        },\n        {\n            'name': _(\"Can submit a translation\"),\n            'codename': \"translate\",\n        },\n        {\n            'name': _(\"Can review suggestions\"),\n            'codename': \"review\",\n        },\n        {\n            'name': _(\"Can administrate a translation project\"),\n            'codename': \"administrate\",\n        },\n    ]\n\n    criteria = {\n        'content_type': pootle_content_type,\n    }\n\n    for permission in permissions:\n        criteria.update(permission)\n        obj, created = Permission.objects.get_or_create(**criteria)\n\n\ndef create_pootle_permission_sets():\n    \"\"\"Create the default permission set for the 'nobody' and 'default' users.\n\n    'nobody' is the anonymous (non-logged in) user, and 'default' is the logged\n    in user.\n    \"\"\"\n    User = get_user_model()\n\n    nobody = User.objects.get(username='nobody')\n    default = User.objects.get(username='default')\n\n    view = get_pootle_permission('view')\n    suggest = get_pootle_permission('suggest')\n    translate = get_pootle_permission('translate')\n\n    # Default permissions for tree root.\n    criteria = {\n        'user': nobody,\n        'directory': Directory.objects.root,\n    }\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = [view, suggest]\n        permission_set.save()\n\n    criteria['user'] = default\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = [view, suggest, translate]\n        permission_set.save()\n\n    # Default permissions for templates language.\n    # Override with no permissions for templates language.\n    criteria = {\n        'user': nobody,\n        'directory': Directory.objects.get(pootle_path=\"/templates/\"),\n    }\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = []\n        permission_set.save()\n\n    criteria['user'] = default\n    permission_set, created = PermissionSet.objects.get_or_create(**criteria)\n    if created:\n        permission_set.positive_permissions = []\n        permission_set.save()\n\n\ndef require_english():\n    \"\"\"Create the English Language item.\"\"\"\n    criteria = {\n        'code': \"en\",\n        'fullname': u\"English\",\n        'nplurals': 2,\n        'pluralequation': \"(n != 1)\",\n    }\n    en, created = Language.objects.get_or_create(**criteria)\n    return en\n\n\ndef create_root_directories():\n    \"\"\"Create the root Directory items.\"\"\"\n    root, created = Directory.objects.get_or_create(name='')\n    projects, created = Directory.objects.get_or_create(name='projects',\n                                                        parent=root)\n\n\ndef create_template_languages():\n    \"\"\"Create the 'templates' and English languages.\n\n    The 'templates' language is used to give users access to the untranslated\n    template files.\n    \"\"\"\n    templates, created = Language.objects.get_or_create(code=\"templates\",\n                                                        fullname=u'Templates')\n    require_english()\n\n\ndef create_terminology_project():\n    \"\"\"Create the terminology project.\n\n    The terminology project is used to display terminology suggestions while\n    translating.\n    \"\"\"\n    criteria = {\n        'code': \"terminology\",\n        'fullname': u\"Terminology\",\n        'source_language': require_english(),\n        'checkstyle': \"terminology\",\n    }\n    terminology, created = Project.objects.get_or_create(**criteria)\n\n\ndef create_default_projects():\n    \"\"\"Create the default projects that we host.\n\n    You might want to add your projects here, although you can also add things\n    through the web interface later.\n    \"\"\"\n    from pootle_project.models import Project\n\n    en = require_english()\n\n    criteria = {\n        'code': u\"tutorial\",\n        'source_language': en,\n        'fullname': u\"Tutorial\",\n        'checkstyle': \"standard\",\n        'localfiletype': \"po\",\n        'treestyle': \"auto\",\n    }\n    tutorial = Project(**criteria)\n    tutorial.save()\n\n    criteria = {\n        'active': True,\n        'title': \"Project instructions\",\n        'body': ('<div dir=\"ltr\" lang=\"en\">Tutorial project where users can '\n                 'play with Pootle and learn more about translation and '\n                 'localisation.<br />For more help on localisation, visit the '\n                 '<a href=\"http://docs.translatehouse.org/projects/'\n                 'localization-guide/en/latest/guide/start.html\">localisation '\n                 'guide</a>.</div>'),\n        'virtual_path': \"announcements/projects/\"+tutorial.code,\n    }\n    ann = Announcement(**criteria)\n    ann.save()\n\n\ndef create_default_languages():\n    \"\"\"Create the default languages.\"\"\"\n    from translate.lang import data, factory\n\n    from pootle_language.models import Language\n\n    # import languages from toolkit\n    for code in data.languages.keys():\n        try:\n            tk_lang = factory.getlanguage(code)\n            criteria = {\n                'code': code,\n                'fullname': tk_lang.fullname,\n                'nplurals': tk_lang.nplurals,\n                'pluralequation': tk_lang.pluralequation,\n            }\n            try:\n                criteria['specialchars'] = tk_lang.specialchars\n            except AttributeError:\n                pass\n            lang, created = Language.objects.get_or_create(**criteria)\n        except:\n            pass\n\n\ndef create_default_admin():\n    \"\"\"Create the default admin user for Pootle.\n\n    You definitely want to change the admin account so that your default\n    install is not accessible with the default credentials. The users 'noboby'\n    and 'default' should be left as is.\n    \"\"\"\n    User = get_user_model()\n\n    criteria = {\n        'username': u\"admin\",\n        'full_name': u\"Administrator\",\n        'is_active': True,\n        'is_superuser': True,\n    }\n    admin = User(**criteria)\n    admin.set_password(\"admin\")\n    admin.save()\n", "path": "pootle/core/initdb.py"}]}