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
88cf7f6a
Commit
88cf7f6a
authored
Jan 22, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move getting linked repo to SubProject manager
parent
fefca754
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
14 deletions
+12
-14
weblate/trans/managers.py
weblate/trans/managers.py
+9
-0
weblate/trans/models.py
weblate/trans/models.py
+2
-2
weblate/trans/util.py
weblate/trans/util.py
+0
-11
weblate/trans/validators.py
weblate/trans/validators.py
+1
-1
No files found.
weblate/trans/managers.py
View file @
88cf7f6a
...
...
@@ -119,6 +119,15 @@ class SubProjectManager(models.Manager):
return
self
.
all
()
return
self
.
filter
(
project__in
=
projects
)
def
get_linked
(
self
,
val
):
'''
Returns subproject for linked repo.
'''
if
not
is_repo_link
(
val
):
return
None
project
,
subproject
=
val
[
10
:].
split
(
'/'
,
1
)
return
self
.
get
(
slug
=
subproject
,
project__slug
=
project
)
class
TranslationManager
(
models
.
Manager
):
def
update_from_blob
(
self
,
subproject
,
code
,
path
,
force
=
False
,
request
=
None
):
...
...
weblate/trans/models.py
View file @
88cf7f6a
...
...
@@ -62,7 +62,7 @@ from weblate.trans.util import (
is_plural
,
split_plural
,
join_plural
,
get_source
,
get_target
,
is_translated
,
get_user_display
,
is_repo_link
,
get_linked_repo
,
is_repo_link
,
)
from
weblate.trans.validators
import
(
validate_repoweb
,
...
...
@@ -639,7 +639,7 @@ class SubProject(models.Model):
'''
Returns subproject for linked repo.
'''
return
get_linked_repo
(
self
.
repo
)
return
SubProject
.
get_linked
(
self
.
repo
)
@
property
def
git_repo
(
self
):
...
...
weblate/trans/util.py
View file @
88cf7f6a
...
...
@@ -204,14 +204,3 @@ def is_repo_link(val):
Checks whethere repository is just a link for other one.
'''
return
val
.
startswith
(
'weblate://'
)
def
get_linked_repo
(
val
):
'''
Returns subproject for linked repo.
'''
if
not
is_repo_link
(
val
):
return
None
project
,
subproject
=
val
[
10
:].
split
(
'/'
,
1
)
from
weblate.trans.models
import
SubProject
return
SubProject
.
objects
.
get
(
slug
=
subproject
,
project__slug
=
project
)
weblate/trans/validators.py
View file @
88cf7f6a
...
...
@@ -67,7 +67,7 @@ def validate_repo(val):
'''
from
weblate.trans.models
import
SubProject
try
:
repo
=
get_linked_repo
(
val
)
repo
=
SubProject
.
get_linked
(
val
)
if
repo
is
not
None
and
repo
.
is_repo_link
():
raise
ValidationError
(
_
(
'Can not link to linked repository!'
))
except
SubProject
.
DoesNotExist
:
...
...
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