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
066f70d3
Commit
066f70d3
authored
Jan 09, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shorten automatic locks (issue #175)
parent
9b656595
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
8 deletions
+37
-8
docs/admin.rst
docs/admin.rst
+4
-2
docs/config.rst
docs/config.rst
+10
-1
weblate/settings_example.py
weblate/settings_example.py
+1
-0
weblate/trans/models.py
weblate/trans/models.py
+21
-4
weblate/trans/views.py
weblate/trans/views.py
+1
-1
No files found.
docs/admin.rst
View file @
066f70d3
...
...
@@ -333,8 +333,10 @@ This can be either done manually on translation page or is done automatically
when somebody starts to work on translation. The automatic locking needs to be
enabled using :setting:`AUTO_LOCK`.
The lock is valid for :setting:`LOCK_TIME` seconds and is automatically
extended on every translation made.
The automatic lock is valid for :setting:`AUTO_LOCK_TIME` seconds and is
automatically extended on every translation made.
User can also explicitly lock translation for :setting:`LOCK_TIME` seconds.
.. _custom-checks:
...
...
docs/config.rst
View file @
066f70d3
...
...
@@ -41,6 +41,15 @@ Enables automatic locking of translation when somebody is working on it.
.. seealso:: :ref:`locking`
.. setting:: AUTO_LOCK_TIME
AUTO_LOCK_TIME
--------------
Time in seconds for how long the automatic lock for translation will be active.
.. seealso:: :ref:`locking`
.. setting:: CHECK_LIST
CHECK_LIST
...
...
@@ -84,7 +93,7 @@ LOCK_TIME
---------
Time in seconds for how long the translation will be locked for single
translator.
translator
when locked manually
.
.. seealso:: :ref:`locking`
...
...
weblate/settings_example.py
View file @
066f70d3
...
...
@@ -316,6 +316,7 @@ OFFLOAD_INDEXING = False
# Translation locking
AUTO_LOCK
=
True
AUTO_LOCK_TIME
=
60
LOCK_TIME
=
15
*
60
# Where to put Whoosh index
...
...
weblate/trans/models.py
View file @
066f70d3
...
...
@@ -1349,18 +1349,35 @@ class Translation(models.Model):
return
True
def
create_lock
(
self
,
user
):
def
create_lock
(
self
,
user
,
explicit
=
False
):
'''
Creates lock on translation.
'''
is_new
=
self
.
lock_user
is
None
self
.
lock_user
=
user
self
.
update_lock_time
()
def
update_lock_time
(
self
):
# Clean timestamp on unlock
if
user
is
None
:
self
.
lock_time
=
datetime
.
now
()
self
.
save
()
return
self
.
update_lock_time
(
explicit
,
is_new
)
def
update_lock_time
(
self
,
explicit
=
False
,
is_new
=
True
):
'''
Sets lock timestamp.
'''
self
.
lock_time
=
datetime
.
now
()
+
timedelta
(
seconds
=
settings
.
LOCK_TIME
)
if
explicit
:
seconds
=
settings
.
LOCK_TIME
else
:
seconds
=
settings
.
AUTO_LOCK_TIME
new_lock_time
=
datetime
.
now
()
+
timedelta
(
seconds
=
seconds
)
if
is_new
or
new_lock_time
>
self
.
lock_time
:
self
.
lock_time
=
new_lock_time
self
.
save
()
def
update_lock
(
self
,
request
):
...
...
weblate/trans/views.py
View file @
066f70d3
...
...
@@ -928,7 +928,7 @@ def lock_translation(request, project, subproject, lang):
)
if
not
obj
.
is_user_locked
(
request
):
obj
.
create_lock
(
request
.
user
)
obj
.
create_lock
(
request
.
user
,
True
)
messages
.
info
(
request
,
_
(
'Translation is now locked for you.'
))
return
HttpResponseRedirect
(
obj
.
get_absolute_url
())
...
...
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