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
8b65f8fd
Commit
8b65f8fd
authored
Jul 11, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement actual subproject locking (issue #56)
parent
47b9085c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
weblate/trans/views.py
weblate/trans/views.py
+13
-4
No files found.
weblate/trans/views.py
View file @
8b65f8fd
...
...
@@ -286,6 +286,9 @@ def show_subproject(request, project, subproject):
obj
=
get_object_or_404
(
SubProject
,
slug
=
subproject
,
project__slug
=
project
)
last_changes
=
Change
.
objects
.
filter
(
unit__translation__subproject
=
obj
).
order_by
(
'-timestamp'
)[:
10
]
if
obj
.
locked
:
messages
.
error
(
request
,
_
(
'This translation is currently locked for updates!'
))
return
render_to_response
(
'subproject.html'
,
RequestContext
(
request
,
{
'object'
:
obj
,
'last_changes'
:
last_changes
,
...
...
@@ -298,7 +301,7 @@ def auto_translation(request, project, subproject, lang):
obj
.
commit_pending
()
autoform
=
AutoForm
(
obj
,
request
.
POST
)
change
=
None
if
autoform
.
is_valid
():
if
not
obj
.
subproject
.
locked
and
autoform
.
is_valid
():
if
autoform
.
cleaned_data
[
'inconsistent'
]:
units
=
obj
.
unit_set
.
filter_type
(
'inconsistent'
)
elif
autoform
.
cleaned_data
[
'overwrite'
]:
...
...
@@ -340,6 +343,9 @@ def show_translation(request, project, subproject, lang):
obj
=
get_object_or_404
(
Translation
,
language__code
=
lang
,
subproject__slug
=
subproject
,
subproject__project__slug
=
project
)
last_changes
=
Change
.
objects
.
filter
(
unit__translation
=
obj
).
order_by
(
'-timestamp'
)[:
10
]
if
obj
.
subproject
.
locked
:
messages
.
error
(
request
,
_
(
'This translation is currently locked for updates!'
))
# How much is user allowed to configure upload?
if
request
.
user
.
has_perm
(
'trans.author_translation'
):
form
=
ExtraUploadForm
()
...
...
@@ -619,6 +625,9 @@ def get_filter_name(rqtype, search_query):
def
translate
(
request
,
project
,
subproject
,
lang
):
obj
=
get_object_or_404
(
Translation
,
language__code
=
lang
,
subproject__slug
=
subproject
,
subproject__project__slug
=
project
)
if
obj
.
subproject
.
locked
:
messages
.
error
(
request
,
_
(
'This translation is currently locked for updates!'
))
if
request
.
user
.
is_authenticated
():
profile
=
request
.
user
.
get_profile
()
else
:
...
...
@@ -632,7 +641,7 @@ def translate(request, project, subproject, lang):
# Any form submitted?
if
request
.
method
==
'POST'
:
form
=
TranslationForm
(
request
.
POST
)
if
form
.
is_valid
():
if
form
.
is_valid
()
and
not
obj
.
subproject
.
locked
:
# Check whether translation is not outdated
obj
.
check_sync
()
try
:
...
...
@@ -746,7 +755,7 @@ def translate(request, project, subproject, lang):
messages
.
error
(
request
,
_
(
'Message you wanted to translate is no longer available!'
))
# Handle accepting/deleting suggestions
if
'accept'
in
request
.
GET
or
'delete'
in
request
.
GET
:
if
not
obj
.
subproject
.
locked
and
(
'accept'
in
request
.
GET
or
'delete'
in
request
.
GET
)
:
# Check for authenticated users
if
not
request
.
user
.
is_authenticated
():
messages
.
error
(
request
,
_
(
'You need to log in to be able to manage suggestions!'
))
...
...
@@ -980,7 +989,7 @@ def upload_translation(request, project, subproject, lang):
'''
obj
=
get_object_or_404
(
Translation
,
language__code
=
lang
,
subproject__slug
=
subproject
,
subproject__project__slug
=
project
)
if
request
.
method
==
'POST'
:
if
not
obj
.
subproject
.
locked
and
request
.
method
==
'POST'
:
if
request
.
user
.
has_perm
(
'trans.author_translation'
):
form
=
ExtraUploadForm
(
request
.
POST
,
request
.
FILES
)
elif
request
.
user
.
has_perm
(
'trans.overwrite_translation'
):
...
...
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