damned-lies r1157 - in trunk: . stats



Author: claudep
Date: Mon Nov 10 12:09:51 2008
New Revision: 1157
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1157&view=rev

Log:
2008-11-10  Claude Paroz  <claude 2xlibre net>

	* README: Fixed typos.
	* TODO: i18n done.
	* stats/models.py: Set msgid-bugs-address in pot files.
	Fixes #555456.
	* stats/views.py: Allow serving release list in JSON and XML.
	* urls.py: Add format specifying in URLs for releases.

Modified:
   trunk/ChangeLog
   trunk/README
   trunk/TODO
   trunk/stats/models.py
   trunk/stats/views.py
   trunk/urls.py

Modified: trunk/README
==============================================================================
--- trunk/README	(original)
+++ trunk/README	Mon Nov 10 12:09:51 2008
@@ -63,8 +63,8 @@
 Running as CGI
 ==============
 
-If you don't won't to setup Django with mod_python, there is a tutorial
+If you don't want to setup Django with mod_python, there is a tutorial
 on the Django Wiki:
 http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/
 
-You'll also file a sample init script in the /docs directory.
+You'll also find a sample init script in the /docs directory.

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Mon Nov 10 12:09:51 2008
@@ -1,3 +1,3 @@
 Things left to do:
- * i18n (translation for strings in database?)
  * Still a webroot in stats_show.html
+ * team_detail.html and language_release.html should share the team detail part.

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Mon Nov 10 12:09:51 2008
@@ -473,7 +473,10 @@
         pot_command = self.pot_method
         podir = vcs_path
         if not self.pot_method: # default is intltool
-            pot_command = "intltool-update -g '%(domain)s' -p" % {'domain': self.potbase()}
+            pot_command = r"""XGETTEXT_ARGS="\"--msgid-bugs-address=%(bugs_enterurl)s\"" intltool-update -g '%(domain)s' -p""" % {
+                               'bugs_enterurl': self.module.get_bugs_enter_url(),
+                               'domain': self.potbase()
+                               }
         elif self.module.name == 'damned-lies':
             # special case for d-l, pot file should be generated from running instance dir
             podir = "."

Modified: trunk/stats/views.py
==============================================================================
--- trunk/stats/views.py	(original)
+++ trunk/stats/views.py	Mon Nov 10 12:09:51 2008
@@ -22,9 +22,13 @@
 from stats.models import Statistics, Module, Release
 from stats.conf import settings
 from djamnedlies.stats import utils
+from django.core import serializers
 from django.http import HttpResponse
 from django.utils.translation import ugettext_lazy as _
 
+MIME_TYPES = {'json': 'application/json',
+              'xml':  'text/xml'
+             }
 def modules(request):
     all_modules = Module.objects.all()
     context = {
@@ -57,13 +61,17 @@
     }
     return render_to_response('module_images.html', context)
 
-def releases(request):
+def releases(request, format='html'):
     all_releases = Release.objects.order_by('status', '-name')
-    context = {
-        'pageSection':  "releases",
-        'releases': all_releases
-    }
-    return render_to_response('release_list.html', context)
+    if format != 'html':
+        data = serializers.serialize(format, all_releases)
+        return HttpResponse(data, mimetype=MIME_TYPES[format])
+    else:
+        context = {
+            'pageSection':  "releases",
+            'releases': all_releases
+        }
+        return render_to_response('release_list.html', context)
 
 def release(request, release_name):
     rel = Release.objects.get(name=release_name)

Modified: trunk/urls.py
==============================================================================
--- trunk/urls.py	(original)
+++ trunk/urls.py	Mon Nov 10 12:09:51 2008
@@ -18,7 +18,7 @@
     url(r'^module/$', 'modules', name='modules'),
     (r'^module/(?P<module_name>[\w\-\+]+)$', 'module'),
     (r'^module/(?P<module_name>[\w\-\+]+)/(?P<potbase>\w+)/(?P<branch_name>[\w-]+)/(?P<langcode>\w+)/images/$', 'docimages'),
-    url(r'^releases/$', 'releases', name='releases'),
+    url(r'^releases/(?P<format>(html|json|xml))?/?$', 'releases', name='releases'),
     (r'^releases/(?P<release_name>[\w-]+)$', 'release'),
 )
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]