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
6e339a34
Commit
6e339a34
authored
Apr 12, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1361255e
875ef404
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
1 deletion
+45
-1
docs/api.rst
docs/api.rst
+17
-0
docs/conf.py
docs/conf.py
+1
-1
docs/index.rst
docs/index.rst
+1
-0
trans/api.py
trans/api.py
+24
-0
urls.py
urls.py
+2
-0
No files found.
docs/api.rst
0 → 100644
View file @
6e339a34
Weblate's Web API
=================
Notification hooks
------------------
Notification hooks allow external applications to notify weblate that Git
repository has been updated.
Exports
-------
Weblate provides various exports to allow you further process the data.
.. http:get:: /exports/stats/(string:project)/(string:subproject)/
Retrieves statistics for given subproject in JSON format.
docs/conf.py
View file @
6e339a34
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions
=
[]
extensions
=
[
'sphinxcontrib.httpdomain'
]
# Add any paths that contain templates here, relative to this directory.
# Add any paths that contain templates here, relative to this directory.
templates_path
=
[
'_templates'
]
templates_path
=
[
'_templates'
]
...
...
docs/index.rst
View file @
6e339a34
...
@@ -17,6 +17,7 @@ Contents:
...
@@ -17,6 +17,7 @@ Contents:
config
config
admin
admin
management
management
api
faq
faq
changes
changes
license
license
...
...
trans/api.py
View file @
6e339a34
...
@@ -3,6 +3,7 @@ from django.views.decorators.csrf import csrf_exempt
...
@@ -3,6 +3,7 @@ from django.views.decorators.csrf import csrf_exempt
from
django.http
import
HttpResponse
,
HttpResponseNotAllowed
,
HttpResponseBadRequest
from
django.http
import
HttpResponse
,
HttpResponseNotAllowed
,
HttpResponseBadRequest
from
trans.models
import
Project
,
SubProject
from
trans.models
import
Project
,
SubProject
from
django.shortcuts
import
get_object_or_404
from
django.shortcuts
import
get_object_or_404
from
django.contrib.sites.models
import
Site
import
json
import
json
import
logging
import
logging
...
@@ -56,3 +57,26 @@ def github_hook(request):
...
@@ -56,3 +57,26 @@ def github_hook(request):
s
.
do_update
()
s
.
do_update
()
return
HttpResponse
(
'updated'
)
return
HttpResponse
(
'updated'
)
def
export_stats
(
request
,
project
,
subproject
):
'''
Exports stats in JSON format.
'''
subprj
=
get_object_or_404
(
SubProject
,
slug
=
subproject
,
project__slug
=
project
)
response
=
[]
site
=
Site
.
objects
.
get_current
()
for
trans
in
subprj
.
translation_set
.
all
():
response
.
append
({
'code'
:
trans
.
language
.
code
,
'name'
:
trans
.
language
.
name
,
'total'
:
trans
.
total
,
'fuzzy'
:
trans
.
fuzzy
,
'translated'
:
trans
.
translated
,
'translated_percent'
:
trans
.
get_translated_percent
(),
'fuzzy_percent'
:
trans
.
get_fuzzy_percent
(),
'url'
:
'http://%s/%s'
%
(
site
.
domain
,
trans
.
get_absolute_url
()),
})
return
HttpResponse
(
json
.
dumps
(
response
),
mimetype
=
'application/json'
)
urls.py
View file @
6e339a34
...
@@ -61,6 +61,8 @@ urlpatterns = patterns('',
...
@@ -61,6 +61,8 @@ urlpatterns = patterns('',
url
(
r'^hooks/update/(?P<project>[^/]*)/$'
,
'trans.api.update_project'
),
url
(
r'^hooks/update/(?P<project>[^/]*)/$'
,
'trans.api.update_project'
),
url
(
r'^hooks/github/$'
,
'trans.api.github_hook'
),
url
(
r'^hooks/github/$'
,
'trans.api.github_hook'
),
url
(
r'^exports/stats/(?P<project>[^/]*)/(?P<subproject>[^/]*)/$'
,
'trans.api.export_stats'
),
url
(
r'^js/get/(?P<checksum>[^/]*)/$'
,
'trans.views.get_string'
),
url
(
r'^js/get/(?P<checksum>[^/]*)/$'
,
'trans.views.get_string'
),
url
(
r'^js/ignore-check/(?P<check_id>[0-9]*)/$'
,
'trans.views.ignore_check'
),
url
(
r'^js/ignore-check/(?P<check_id>[0-9]*)/$'
,
'trans.views.ignore_check'
),
url
(
r'^js/i18n/$'
,
'django.views.i18n.javascript_catalog'
,
js_info_dict
),
url
(
r'^js/i18n/$'
,
'django.views.i18n.javascript_catalog'
,
js_info_dict
),
...
...
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