damned-lies r1161 - in trunk: . media/css stats templates templates/languages



Author: claudep
Date: Wed Nov 12 13:49:08 2008
New Revision: 1161
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1161&view=rev

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

	* media/css/main.css: Add style for error listing.
	* stats/admin.py: Add Information inline on Statistics admin detail.
	* stats/utils.py: Missing comma in unique tuple. No need to output entire
	path in error message.
	* stats/models.py: Add 'all_errors' in language stats, so as we can output
	an error summary.
	Fixes #411248.
	* templates/languages/language_release_stats.html: Display errors in stats
	and an error summary at the bottom.
	* templates/module_images.html: Translate domain description.

Modified:
   trunk/ChangeLog
   trunk/media/css/main.css
   trunk/stats/admin.py
   trunk/stats/models.py
   trunk/stats/utils.py
   trunk/templates/languages/language_release_stats.html
   trunk/templates/module_images.html

Modified: trunk/media/css/main.css
==============================================================================
--- trunk/media/css/main.css	(original)
+++ trunk/media/css/main.css	Wed Nov 12 13:49:08 2008
@@ -136,6 +136,11 @@
   color: #666666;
 }
 
+.error {
+  font-style: italic;
+  color: #666666;
+}
+
 .footnote {
   text-align: center;
   font-size: small;

Modified: trunk/stats/admin.py
==============================================================================
--- trunk/stats/admin.py	(original)
+++ trunk/stats/admin.py	Wed Nov 12 13:49:08 2008
@@ -19,7 +19,7 @@
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from django.contrib import admin
-from stats.models import Statistics, Module, Branch, Domain, Category, Release
+from stats.models import Statistics, Information, Module, Branch, Domain, Category, Release
 
 class BranchInline(admin.TabularInline):
     model = Branch
@@ -72,8 +72,13 @@
     list_display = ('name', 'status', 'stringfrozen')
     inlines = [ CategoryInline ]
 
+class InformationInline(admin.TabularInline):
+    model = Information
+    extra = 0
+
 class StatisticsAdmin(admin.ModelAdmin):
     search_fields = ('language__name', 'branch__module__name')
+    inlines = [ InformationInline ]
 
 admin.site.register(Statistics, StatisticsAdmin)
 admin.site.register(Branch, BranchAdmin)

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Wed Nov 12 13:49:08 2008
@@ -255,7 +255,6 @@
             # ***********************************
             pot_stats = utils.po_file_stats(potfile, 0)
             errors.extend(pot_stats['errors'])
-
             if potfile != previous_pot and not utils.copy_file(potfile, previous_pot):
                 errors.append(('error', ugettext_noop("Can't copy new POT file to public location.")))
 
@@ -494,8 +493,8 @@
         if error or not os.access(potfile, os.R_OK):
             return "", (("error", ugettext_noop("Error regenerating POT file for %(file)s:\n<pre>%(cmd)s\n%(output)s</pre>")
                                  % {'file': self.potbase(),
-                                    'cmd': command,
-                                    'output': output})
+                                    'cmd': pot_command,
+                                    'output': output.decode('utf-8')}),
                        )
         else:
             return potfile, ()
@@ -666,8 +665,8 @@
         
         # Sorted by module to allow grouping ('fake' stats)
         pot_stats = Statistics.objects.filter(language=None, branch__releases=self).order_by('domain__module__id', 'domain__dtype')
-        stats = {'doc':{'totaltrans':0, 'totalfuzzy':0, 'totaluntrans':0, 'categs':{}}, 
-                 'ui':{'totaltrans':0, 'totalfuzzy':0, 'totaluntrans':0, 'categs':{}} 
+        stats = {'doc':{'totaltrans':0, 'totalfuzzy':0, 'totaluntrans':0, 'categs':{}, 'all_errors':[]}, 
+                 'ui':{'totaltrans':0, 'totalfuzzy':0, 'totaluntrans':0, 'categs':{}, 'all_errors':[]} 
                 }
         for stat in pot_stats:
             dtype = stat.domain.dtype
@@ -709,6 +708,7 @@
                 stats[dtype]['categs'][categdescr]['modules'][modname][' fake'].trans(stat)
             # Replace POT stat by translated stat
             stats[dtype]['categs'][categdescr]['modules'][modname][domname] = stat
+            stats[dtype]['all_errors'].extend(stat.information_set.all())
         
         # Compute percentages and sorting
         for dtype in ['ui', 'doc']:
@@ -734,6 +734,8 @@
                     doms = [(name,dom) for name, dom in mod[1].items()]
                     doms.sort()
                     mod[1] = doms
+            # Sort errors
+            stats[dtype]['all_errors'].sort()
         return stats
 
 
@@ -842,7 +844,6 @@
     
     def pot_text(self):
         """ Return stat table header: 'POT file (n messages) - updated on ??-??-???? tz' """
-        #import pdb; pdb.set_trace()
         msg_text = ungettext(u"%(count)s message", "%(count)s messages", self.pot_size()) % {'count': self.pot_size()}
         upd_text = _(u"updated on %(date)s") % {'date': self.date.strftime("%Y-%m-%d %H:%M:%S ")+tzname[0]}
         if self.fig_count():
@@ -1010,6 +1011,9 @@
     class Meta:
         db_table = 'information'
 
+    def __cmp__(self, other):
+        return cmp(self.Statistics.module_name(), other.Statistics.module_name())
+
     def get_icon(self):
         return "/media/img/%s.png" % self.Type
     

Modified: trunk/stats/utils.py
==============================================================================
--- trunk/stats/utils.py	(original)
+++ trunk/stats/utils.py	Wed Nov 12 13:49:08 2008
@@ -78,7 +78,7 @@
     errors = []
     modulename = read_makefile_variable(vcs_path, "DOC_MODULE")
     if not modulename:
-        return "", (("error", ugettext_noop("Module %s doesn't look like gnome-doc-utils module.") % moduleid))
+        return "", (("error", ugettext_noop("Module %s doesn't look like gnome-doc-utils module.") % moduleid),)
     if not os.access(os.path.join(vcs_path, "C", modulename + ".xml"), os.R_OK):
         if os.access(os.path.join(vcs_path, "C", moduleid + ".xml"), os.R_OK):
             errors.append(("warn", ugettext_noop("DOC_MODULE doesn't resolve to a real file, using '%s.xml'.") % (moduleid)))
@@ -162,7 +162,7 @@
 
     if error:
         if msgfmt_checks:
-            errors.append(("error", ugettext_noop("PO file '%s' doesn't pass msgfmt check: not updating.") % (pofile)))
+            errors.append(("error", ugettext_noop("PO file '%s' doesn't pass msgfmt check: not updating.") % (os.path.basename(pofile))))
         else:
             errors.append(("error", ugettext_noop("Can't get statistics for POT file '%s'.") % (pofile)))
 

Modified: trunk/templates/languages/language_release_stats.html
==============================================================================
--- trunk/templates/languages/language_release_stats.html	(original)
+++ trunk/templates/languages/language_release_stats.html	Wed Nov 12 13:49:08 2008
@@ -50,7 +50,11 @@
             {% else %}
               <a href="{% url stats.views.module modname %}" style="font-style: italic;">
             {% endif %}
-            {{ dom.1.module_description }}</a></td>
+            {{ dom.1.module_description }}</a>
+            {% for err in dom.1.information_set.all %}
+              <img src="{{ err.get_icon }}" title="{{ err.get_description }}" alt="{{ err.Type }}" />
+            {% endfor %}
+            </td>
           {% endif %}
           <td>{{ dom.1.tr_percentage }}%&nbsp;({{ dom.1.translated }}/{{ dom.1.fuzzy }}/{{ dom.1.untranslated }})</td>
           <td style="width: 108px; text-align: center; background:inherit;"><div class="graph">
@@ -70,3 +74,12 @@
 {% endfor %}
 </table>
 
+{% if modstats.all_errors %}
+  <h3>{% trans "Error summary" %}</h3>
+  <ul>
+  {% for err in modstats.all_errors %}
+    <li><img src="{{ err.get_icon }}" alt="{{ err.Type }}" /> {{ err.Statistics.module_name }}:<br />
+        <span class="error">{{ err.get_description }}</span></li>
+  {% endfor %}
+  </ul>
+{% endif %}

Modified: trunk/templates/module_images.html
==============================================================================
--- trunk/templates/module_images.html	(original)
+++ trunk/templates/module_images.html	Wed Nov 12 13:49:08 2008
@@ -6,7 +6,7 @@
 {% block content %}
 <div class="mainpage">
 
-<h1><a href="{% url stats.views.module module.name %}">{{ module.description }}</a> {{ stat.domain.description }} ({% trans stat.language.name %})</h1>
+<h1><a href="{% url stats.views.module module.name %}">{{ module.description }}</a> {% trans stat.domain.description %} ({% trans stat.language.name %})</h1>
 
 {% with stat.fig_stats as figstat %}
 <h2>{% trans "Figures translation status" %} &mdash; 



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