Merge remote-tracking branch 'origin/versions/micro' into merges/micro_to_minor

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-10-28 00:06:27 -04:00
1068 changed files with 6407 additions and 5860 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ class PlatformApp(MayanAppConfig):
app_namespace = 'platform'
app_url = 'platform'
has_rest_api = False
has_tests = False
has_tests = True
name = 'mayan.apps.platform'
verbose_name = _('Platform')
+15 -8
View File
@@ -3,8 +3,10 @@ from __future__ import absolute_import, unicode_literals
import os
from django.template import loader
from django.utils.html import mark_safe
from django.template.base import Template
from django.template.context import Context
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import mark_safe
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.serialization import yaml_dump, yaml_load
@@ -46,8 +48,10 @@ class PlatformTemplate(object):
context = {}
context_defaults = {}
label = None
name = None
settings = None
template_name = None
template_string = None
variables = None
@classmethod
@@ -109,10 +113,15 @@ class PlatformTemplate(object):
context.update(
yaml_load(stream=context_string)
)
return loader.render_to_string(
template_name=self.get_template_name(),
context=context
)
if self.template_string:
template = Template(template_string=self.template_string)
return template.render(context=Context(dict_=context))
else:
return loader.render_to_string(
template_name=self.get_template_name(),
context=context
)
class PlatformTemplateSupervisord(PlatformTemplate):
@@ -168,9 +177,7 @@ class PlatformTemplateSupervisord(PlatformTemplate):
)
def get_context(self):
return {
'workers': Worker.all()
}
return {'workers': Worker.all()}
class PlatformTemplateSupervisordDocker(PlatformTemplate):
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Mohammed ALDOUB <voulnet@gmail.com>, 2019\n"
"Language-Team: Arabic (https://www.transifex.com/rosarior/teams/13584/ar/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Platform"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
Binary file not shown.
@@ -5,15 +5,16 @@
#
# Translators:
# Iliya Georgiev <inactive+iliicho7@transifex.com>, 2019
# Lyudmil Antonov <lantonov.here@gmail.com>, 2019
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Iliya Georgiev <inactive+iliicho7@transifex.com>, 2019\n"
"Last-Translator: Lyudmil Antonov <lantonov.here@gmail.com>, 2019\n"
"Language-Team: Bulgarian (https://www.transifex.com/rosarior/teams/13584/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -25,10 +26,10 @@ msgstr ""
msgid "Platform"
msgstr "Платформа"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
msgstr "Шаблон за Supervisord"
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
msgstr "Шаблон за Supervisord в Docker образ"
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: www.ping.ba <jomer@ping.ba>, 2019\n"
"Language-Team: Bosnian (Bosnia and Herzegovina) (https://www.transifex.com/rosarior/teams/13584/bs_BA/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Platforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
Binary file not shown.
@@ -3,13 +3,17 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Michal Švábík <snadno@lehce.cz>, 2019
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Michal Švábík <snadno@lehce.cz>, 2019\n"
"Language-Team: Czech (https://www.transifex.com/rosarior/teams/13584/cs/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -19,12 +23,12 @@ msgstr ""
#: apps.py:14
msgid "Platform"
msgstr ""
msgstr "Platforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
msgstr "Šablona pro supervisord."
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
msgstr "Šablona pro supervisord uvnitř obrazu Docker."
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Danish (Denmark) (https://www.transifex.com/rosarior/teams/13584/da_DK/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Mathias Behrle <mathiasb@m9s.biz>, 2019\n"
"Language-Team: German (Germany) (https://www.transifex.com/rosarior/teams/13584/de_DE/)\n"
@@ -26,10 +26,10 @@ msgstr ""
msgid "Platform"
msgstr "Plattform"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr "Konfigurationsvorlage für Supervisord."
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr "Konfigurationsvorlage innerhalb des Dockerimages für Supervisord."
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Greek (https://www.transifex.com/rosarior/teams/13584/el/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Roberto Rosario, 2019\n"
"Language-Team: Spanish (https://www.transifex.com/rosarior/teams/13584/es/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Plataforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr "Plantilla para Supervisord."
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr "Plantilla para Supervisord dentro de una imagen Docker."
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Mehdi Amani <MehdiAmani@toorintan.com>, 2019\n"
"Language-Team: Persian (https://www.transifex.com/rosarior/teams/13584/fa/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "ایستگاه"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Frédéric Sheedy <sheedf@gmail.com>, 2019\n"
"Language-Team: French (https://www.transifex.com/rosarior/teams/13584/fr/)\n"
@@ -26,10 +26,10 @@ msgstr ""
msgid "Platform"
msgstr "Plateforme"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr "Modèle pour Supervisord."
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr "Modèle pour Supervisord dans une image Docker."
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Hungarian (https://www.transifex.com/rosarior/teams/13584/hu/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Indonesian (https://www.transifex.com/rosarior/teams/13584/id/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Marco Camplese <marco.camplese.mc@gmail.com>, 2019\n"
"Language-Team: Italian (https://www.transifex.com/rosarior/teams/13584/it/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Piattaforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Māris Teivāns <maris.teivans@gmail.com>, 2019\n"
"Language-Team: Latvian (https://www.transifex.com/rosarior/teams/13584/lv/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Platforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr "Veidne priekš Supervisord."
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr "Supervisord veidne Docker attēla iekšpusē."
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Evelijn Saaltink <evelijnsaaltink@gmail.com>, 2019\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/rosarior/teams/13584/nl_NL/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Platform"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Marcin Lozynski <mlozynski@wp.pl>, 2019\n"
"Language-Team: Polish (https://www.transifex.com/rosarior/teams/13584/pl/)\n"
@@ -26,10 +26,10 @@ msgstr ""
msgid "Platform"
msgstr "Platforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr "Szablon dla zarządzającego"
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr "Szablon dla zarządzającego wewnątrz obrazu Docker'a"
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Manuela Silva <inactive+h_manuela_rodsilva@transifex.com>, 2019\n"
"Language-Team: Portuguese (https://www.transifex.com/rosarior/teams/13584/pt/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Platforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Rogerio Falcone <rogerio@falconeit.com.br>, 2019\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/rosarior/teams/13584/pt_BR/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Plataforma"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Harald Ersch, 2019\n"
"Language-Team: Romanian (Romania) (https://www.transifex.com/rosarior/teams/13584/ro_RO/)\n"
@@ -26,10 +26,10 @@ msgstr ""
msgid "Platform"
msgstr "Platformă"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr "Șablon pentru Supervisord."
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr "Șablon pentru Supervisord în interiorul unei imagini Docker."
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Last-Translator: Sergey Glita <gsv70@mail.ru>, 2019\n"
"Language-Team: Russian (https://www.transifex.com/rosarior/teams/13584/ru/)\n"
@@ -25,10 +25,10 @@ msgstr ""
msgid "Platform"
msgstr "Platform"
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Slovenian (Slovenia) (https://www.transifex.com/rosarior/teams/13584/sl_SI/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Turkish (Turkey) (https://www.transifex.com/rosarior/teams/13584/tr_TR/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Vietnamese (Viet Nam) (https://www.transifex.com/rosarior/teams/13584/vi_VN/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-24 23:19-0400\n"
"POT-Creation-Date: 2019-10-27 15:00-0400\n"
"PO-Revision-Date: 2019-05-17 05:51+0000\n"
"Language-Team: Chinese (https://www.transifex.com/rosarior/teams/13584/zh/)\n"
"MIME-Version: 1.0\n"
@@ -21,10 +21,10 @@ msgstr ""
msgid "Platform"
msgstr ""
#: classes.py:113
#: classes.py:122
msgid "Template for Supervisord."
msgstr ""
#: classes.py:168
#: classes.py:175
msgid "Template for Supervisord inside a Docker image."
msgstr ""
@@ -16,8 +16,8 @@ class Command(management.BaseCommand):
)
parser.add_argument(
'--context', action='store', default='', dest='context',
help='Pass a context to the template in the form of a JSON encoded '
'dictionary.',
help='Pass a context to the template in the form of a YAML '
'encoded dictionary.',
)
def handle(self, *args, **options):
@@ -40,6 +40,8 @@ class Command(management.BaseCommand):
)
exit(1)
else:
self.stdout.write(template().render(
context_string=options.get('context'))
self.stdout.write(
template().render(
context_string=options.get('context')
)
)
@@ -0,0 +1,61 @@
from __future__ import unicode_literals
from io import BytesIO
from django.core import management
from django.test import TestCase
from ..classes import PlatformTemplate
TEST_TEMPLATE_LABEL = 'test template label'
TEST_TEMPLATE_NAME = 'test_template_name'
TEST_TEMPLATE_STRING = '''
test template string
test template variable: {{ test_template_variable }}
'''
TEST_TEMPLATE_VARIABLE_VALUE = 'test_variable_value'
TEST_TEMPLATE_VARIABLE_VALUE_ALT = 'test_variable_value_alt'
TEST_TEMPLATE_STRING_RENDER = '''
test template string
test template variable: {}
'''.format(TEST_TEMPLATE_VARIABLE_VALUE)
TEST_TEMPLATE_STRING_RENDER_ALT = '''
test template string
test template variable: {}
'''.format(TEST_TEMPLATE_VARIABLE_VALUE_ALT)
class TestPlatformTemplate(PlatformTemplate):
context = {'test_template_variable': TEST_TEMPLATE_VARIABLE_VALUE}
label = TEST_TEMPLATE_LABEL
name = TEST_TEMPLATE_NAME
template_string = TEST_TEMPLATE_STRING
PlatformTemplate.register(klass=TestPlatformTemplate)
class PlatformTemplateManagementCommandTestCase(TestCase):
def test_platform_template_simple(self):
output = BytesIO()
args = (TEST_TEMPLATE_NAME,)
options = {
'stdout': output
}
management.call_command('platformtemplate', *args, **options)
self.assertEqual(output.getvalue(), TEST_TEMPLATE_STRING_RENDER)
def test_platform_template_context(self):
output = BytesIO()
args = (
TEST_TEMPLATE_NAME, '--context',
'test_template_variable: {}'.format(
TEST_TEMPLATE_VARIABLE_VALUE_ALT
)
)
options = {
'stdout': output
}
management.call_command('platformtemplate', *args, **options)
self.assertEqual(output.getvalue(), TEST_TEMPLATE_STRING_RENDER_ALT)