damned-lies r1162 - in trunk: . stats stats/management/commands



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

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

	* settings_sample.py: Add SERVER_EMAIL and EMAIL_SUBJECT_PREFIX for
	sending mail.
	* stats/management/commands/update-stats.py: Send mail to admins when
	something go wrong during module update.
	* stats/models.py: Fixed trivial error.
	* urls.py: Support '-' in potbase name.

Modified:
   trunk/ChangeLog
   trunk/settings_sample.py
   trunk/stats/management/commands/update-stats.py
   trunk/stats/models.py
   trunk/urls.py

Modified: trunk/settings_sample.py
==============================================================================
--- trunk/settings_sample.py	(original)
+++ trunk/settings_sample.py	Wed Nov 12 15:13:02 2008
@@ -13,6 +13,9 @@
     ('Stephane Raimbault', 'stephane raimbault gmail com'),
 )
 
+SERVER_EMAIL = 'gnomeweb gnome org'
+EMAIL_SUBJECT_PREFIX = '[Damned Lies] '
+
 MANAGERS = ADMINS
 
 DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.

Modified: trunk/stats/management/commands/update-stats.py
==============================================================================
--- trunk/stats/management/commands/update-stats.py	(original)
+++ trunk/stats/management/commands/update-stats.py	Wed Nov 12 15:13:02 2008
@@ -1,6 +1,7 @@
-import os
+import os, traceback
 from optparse import make_option
 from django.core.management.base import BaseCommand
+from django.core.mail import mail_admins
 from stats.models import Module, Branch
 
 class Command(BaseCommand):
@@ -27,7 +28,13 @@
                     print "Unable to find branch '%s' for module '%s' in the database." % (branch_arg, module_arg)
                     return "Update unsuccessful."
                 print "Updating stats for %s.%s..." % (module_arg, branch_arg)
-                branch.update_stats(options['force'])
+                try:
+                    branch.update_stats(options['force'])
+                except:
+                    tbtext = traceback.format_exc()
+                    mail_admins("Error while updating %s %s" % (module_arg, branch_arg), tbtext)
+                    print "Error during updating, mail sent to admins"
+                    
             elif len(args) == 1:
                 module_arg = args[0]
                 print "Updating stats for %s..." % (module_arg)

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Wed Nov 12 15:13:02 2008
@@ -244,7 +244,7 @@
                 if string_freezed and dom.dtype == 'ui':
                     diff = potdiff.diff(previous_pot, potfile, 1)
                     if len(diff):
-                        self.notify_list(out_domain, diff)
+                        utils.notify_list("%s.%s" % (self.module.name, self.name), diff)
 
                 # If old pot already exists, lets see if it has changed at all
                 diff = potdiff.diff(previous_pot, potfile)

Modified: trunk/urls.py
==============================================================================
--- trunk/urls.py	(original)
+++ trunk/urls.py	Wed Nov 12 15:13:02 2008
@@ -17,7 +17,7 @@
 urlpatterns += patterns('stats.views',
     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'),
+    (r'^module/(?P<module_name>[\w\-\+]+)/(?P<potbase>[\w-]+)/(?P<branch_name>[\w-]+)/(?P<langcode>\w+)/images/$', 'docimages'),
     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]