Commit f010757c authored by Michal Čihař's avatar Michal Čihař

Move helper to appsettings, not used anywhere else

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent aae9110c
...@@ -19,10 +19,24 @@ ...@@ -19,10 +19,24 @@
# #
from django.conf import settings from django.conf import settings
from weblate.trans.scripts import get_script_choices
import os import os
def get_script_name(name):
'''
Returns script name from string possibly containing full path and
parameters.
'''
return os.path.basename(name).split()[0]
def get_script_choices(choices):
"""Generates list of script choice in the Admin interface."""
return [
(script, get_script_name(script)) for script in choices
] + [('', '')]
def getvalue(name, default): def getvalue(name, default):
""" """
Returns setting from django settings with default value. Returns setting from django settings with default value.
......
...@@ -20,26 +20,10 @@ ...@@ -20,26 +20,10 @@
# #
"""Hook scripts handling""" """Hook scripts handling"""
import os.path
import subprocess import subprocess
from weblate.trans.util import get_clean_env from weblate.trans.util import get_clean_env
def get_script_name(name):
'''
Returns script name from string possibly containing full path and
parameters.
'''
return os.path.basename(name).split()[0]
def get_script_choices(choices):
"""Generates list of script choice in the Admin interface."""
return [
(script, get_script_name(script)) for script in choices
] + [('', '')]
def run_post_push_script(component): def run_post_push_script(component):
"""Run post push hook""" """Run post push hook"""
run_hook(component, None, component.post_push_script) run_hook(component, None, component.post_push_script)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
from unittest import TestCase from unittest import TestCase
from weblate.trans.util import cleanup_repo_url from weblate.trans.util import cleanup_repo_url
from weblate.trans.scripts import get_script_name from weblate.appsettings import get_script_name
class HideCredentialsTest(TestCase): class HideCredentialsTest(TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment