Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
a4336479
Commit
a4336479
authored
Sep 10, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Share code for generating script choices
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
df0f4570
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
weblate/appsettings.py
weblate/appsettings.py
+10
-16
weblate/trans/scripts.py
weblate/trans/scripts.py
+7
-0
No files found.
weblate/appsettings.py
View file @
a4336479
...
...
@@ -19,7 +19,7 @@
#
from
django.conf
import
settings
from
weblate.trans.scripts
import
get_script_
name
from
weblate.trans.scripts
import
get_script_
choices
import
os
...
...
@@ -144,25 +144,19 @@ MACHINE_TRANSLATION_ENABLED = len(MACHINE_TRANSLATION_SERVICES) > 0
# List of scripts to use in custom processing
POST_UPDATE_SCRIPTS
=
getvalue
(
'POST_UPDATE_SCRIPTS'
,
())
POST_UPDATE_SCRIPT_CHOICES
=
[
(
script
,
get_script_name
(
script
))
for
script
in
POST_UPDATE_SCRIPTS
]
+
[(
''
,
''
)]
POST_UPDATE_SCRIPT_CHOICES
=
get_script_choices
(
POST_UPDATE_SCRIPTS
)
PRE_COMMIT_SCRIPTS
=
getvalue
(
'PRE_COMMIT_SCRIPTS'
,
())
PRE_COMMIT_SCRIPT_CHOICES
=
[
(
script
,
get_script_name
(
script
))
for
script
in
PRE_COMMIT_SCRIPTS
]
+
[(
''
,
''
)]
PRE_COMMIT_SCRIPT_CHOICES
=
get_script_choices
(
PRE_COMMIT_SCRIPTS
)
POST_COMMIT_SCRIPTS
=
getvalue
(
'POST_COMMIT_SCRIPTS'
,
())
POST_COMMIT_SCRIPT_CHOICES
=
[
(
script
,
get_script_name
(
script
))
for
script
in
POST_COMMIT_SCRIPTS
]
+
[(
''
,
''
)]
POST_COMMIT_SCRIPT_CHOICES
=
get_script_choices
(
POST_COMMIT_SCRIPTS
)
POST_PUSH_SCRIPTS
=
getvalue
(
'POST_PUSH_SCRIPTS'
,
())
POST_PUSH_SCRIPT_CHOICES
=
[
(
script
,
get_script_name
(
script
))
for
script
in
POST_PUSH_SCRIPTS
]
+
[(
''
,
''
)]
POST_PUSH_SCRIPT_CHOICES
=
get_script_choices
(
POST_PUSH_SCRIPTS
)
POST_ADD_SCRIPTS
=
getvalue
(
'POST_ADD_SCRIPTS'
,
())
POST_ADD_SCRIPT_CHOICES
=
[
(
script
,
get_script_name
(
script
))
for
script
in
POST_ADD_SCRIPTS
]
+
[(
''
,
''
)]
POST_ADD_SCRIPT_CHOICES
=
get_script_choices
(
POST_ADD_SCRIPTS
)
# Font for charts and widgets
TTF_PATH
=
getvalue
(
'TTF_PATH'
,
os
.
path
.
join
(
BASE_DIR
,
'ttf'
))
...
...
weblate/trans/scripts.py
View file @
a4336479
...
...
@@ -33,6 +33,13 @@ def get_script_name(name):
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
):
"""Run post push hook"""
run_hook
(
component
,
component
.
post_push_script
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment