damned-lies r1520 - in trunk: . stats templates templates/vertimus vertimus



Author: claudep
Date: Mon Mar 30 18:40:58 2009
New Revision: 1520
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1520&view=rev

Log:
2009-03-30  Claude Paroz  <claude 2xlibre net>

	* settings_sample.py: Add settings for defining the project VCS.
	* stats/models.py: New method to determine if module is hosted in project
	VCS.
	* stats/views.py:
	* vertimus/views.py: Pass non_standard_repo_msg to the templates.
	* templates/module_detail.html:
	* templates/vertimus/vertimus_detail.html: Use new method of specifying if
	module is hosted on project VCS.

Modified:
   trunk/ChangeLog
   trunk/settings_sample.py
   trunk/stats/models.py
   trunk/stats/views.py
   trunk/templates/module_detail.html
   trunk/templates/vertimus/vertimus_detail.html
   trunk/vertimus/views.py

Modified: trunk/settings_sample.py
==============================================================================
--- trunk/settings_sample.py	(original)
+++ trunk/settings_sample.py	Mon Mar 30 18:40:58 2009
@@ -1,6 +1,7 @@
 # Django settings for djamnedlies project.
 
 import os
+gettext_noop = lambda s: s
 
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
@@ -73,6 +74,11 @@
 # Local directory path for VCS checkout
 SCRATCHDIR = ""
 POTDIR = os.path.join(SCRATCHDIR, "POT")
+
+# The regex is used to determine if the module is in the standard VCS of the project
+VCS_HOME_REGEX = "svn\.gnome\.org"
+VCS_HOME_WARNING = gettext_noop(u"This module is not part of the GNOME SVN repository. Please check the module's web page to see where to send translations.")
+
 # By default, Django stores files locally, using the MEDIA_ROOT and MEDIA_URL settings
 UPLOAD_DIR = 'upload'
 UPLOAD_BACKUP_DIR = 'upload-backup'

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Mon Mar 30 18:40:58 2009
@@ -83,6 +83,10 @@
         else:
             return self.name
     
+    def has_standard_vcs(self):
+        """ This function checks if the module is hosted in the standard VCS of the project """
+        return re.search(settings.VCS_HOME_REGEX, self.vcs_root) is not None
+        
     def get_bugs_i18n_url(self):
         if self.bugs_base.find("bugzilla") != -1 or self.bugs_base.find("freedesktop") != -1:
             return utils.url_join(self.bugs_base,

Modified: trunk/stats/views.py
==============================================================================
--- trunk/stats/views.py	(original)
+++ trunk/stats/views.py	Mon Mar 30 18:40:58 2009
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (c) 2008 Claude Paroz <claude 2xlibre net>.
+# Copyright (c) 2008-2009 Claude Paroz <claude 2xlibre net>.
 #
 # This file is part of Damned Lies.
 #
@@ -18,11 +18,13 @@
 # along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+from django.conf import settings
 from django.shortcuts import render_to_response, get_object_or_404
 from django.contrib.auth.decorators import login_required
 from django.core import serializers
 from django.http import HttpResponse
 from django.template import RequestContext
+from django.utils.translation import ugettext as _
 
 from stats.models import Statistics, Module, Branch, Category, Release
 from stats.forms import ModuleBranchForm
@@ -44,6 +46,7 @@
     context = {
         'pageSection':  "module",
         'module': mod,
+        'non_standard_repo_msg' : _(settings.VCS_HOME_WARNING),
         'can_edit_branches': mod.can_edit_branches(request.user),
     }
     return render_to_response('module_detail.html', context, context_instance=RequestContext(request))

Modified: trunk/templates/module_detail.html
==============================================================================
--- trunk/templates/module_detail.html	(original)
+++ trunk/templates/module_detail.html	Mon Mar 30 18:40:58 2009
@@ -13,9 +13,9 @@
 {% if module.comment %}
   <p>{% trans module.comment %}</p>
 {% else %}
-  {% ifnotequal module.vcs_root "http://svn.gnome.org/svn"; %}
-  <p><em><img src="/media/img/warn.png" alt="Warning logo" />{% trans "This module is not part of the GNOME SVN repository. Please check the module's web page to see where to send translations." %}</em></p>
-  {% endifnotequal %}
+  {% if not module.has_standard_vcs %}
+  <p><em><img src="/media/img/warn.png" alt="Warning logo" /> {{ non_standard_repo_msg }}</em></p>
+  {% endif %}
 {% endif %}
 
 {% if module.homepage %}

Modified: trunk/templates/vertimus/vertimus_detail.html
==============================================================================
--- trunk/templates/vertimus/vertimus_detail.html	(original)
+++ trunk/templates/vertimus/vertimus_detail.html	Mon Mar 30 18:40:58 2009
@@ -23,9 +23,9 @@
 {% if module.comment %}
   <p>{{ module.comment|safe }}</p>
 {% else %}
-  {% ifnotequal module.vcs_root "http://svn.gnome.org/svn"; %}
-  <p><i><img src="{{ MEDIA_URL }}img/warn.png" alt="Warning logo" />{% trans "This module is not part of the GNOME SVN repository. Please check the module's web page to see where to send translations." %}</i></p>
-  {% endifnotequal %}
+  {% if not module.has_standard_vcs %}
+  <p><em><img src="{{ MEDIA_URL }}img/warn.png" alt="Warning logo" /> {{ non_standard_repo_msg }}</em></p>
+  {% endif %}
 {% endif %}
 
 <h3>{% trans "State:" %} {{ state.description }}

Modified: trunk/vertimus/views.py
==============================================================================
--- trunk/vertimus/views.py	(original)
+++ trunk/vertimus/views.py	Mon Mar 30 18:40:58 2009
@@ -18,6 +18,7 @@
 # along with Damned Lies; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
+from django.conf import settings
 from django.utils.translation import ugettext as _
 from django.shortcuts import render_to_response, get_object_or_404
 from django.http import HttpResponseRedirect
@@ -102,6 +103,7 @@
         'domain': domain,
         'language': language,
         'module': branch.module,
+        'non_standard_repo_msg' : _(settings.VCS_HOME_WARNING),
         'state': state,
         'action_history': action_history, 
         'action_form': action_form



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