damned-lies r1202 - in trunk: . stats stats/management/commands templates



Author: stephaner
Date: Fri Dec  5 22:21:07 2008
New Revision: 1202
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1202&view=rev

Log:
2008-12-05  StÃphane Raimbault  <stephane raimbault gmail com>

	* stats/management/commands/update-stats.py: Added comments.
	* stats/models.py: Added comments.
	* stats/utils.py: Minor PEP-8.
	* stats/views.py: *_detail as generic views.
	* templates/module_detail.html: 
	* templates/release_detail.html: New names.
	* stats/management/commands/migrate.py: Removed (migrated).


Added:
   trunk/templates/module_detail.html
      - copied unchanged from r1198, /trunk/templates/module.html
   trunk/templates/release_detail.html
      - copied unchanged from r1201, /trunk/templates/release.html
Removed:
   trunk/stats/management/commands/migrate.py
Modified:
   trunk/ChangeLog
   trunk/stats/management/commands/update-stats.py
   trunk/stats/models.py
   trunk/stats/utils.py
   trunk/stats/views.py

Modified: trunk/stats/management/commands/update-stats.py
==============================================================================
--- trunk/stats/management/commands/update-stats.py	(original)
+++ trunk/stats/management/commands/update-stats.py	Fri Dec  5 22:21:07 2008
@@ -18,6 +18,7 @@
     def handle(self, *args, **options):
         if len(args) <= 2:
             if len(args) == 2:
+                # Update the specific branch of a module
                 module_arg = args[0]
                 branch_arg = args[1]
                 if branch_arg == "trunk":
@@ -36,12 +37,14 @@
                     print "Error during updating, mail sent to admins"
                     
             elif len(args) == 1:
+                # Update all branches of a module
                 module_arg = args[0]
                 print "Updating stats for %s..." % (module_arg)
                 branches = Branch.objects.filter(module__name=module_arg)
                 for branch in branches.all():
                     branch.update_stats(options['force'])
             else:
+                # Update all modules
                 modules = Module.objects.all()
                 for mod in modules:
                     print "Updating stats for %s..." % (mod.name)

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Fri Dec  5 22:21:07 2008
@@ -222,9 +222,9 @@
     def update_stats(self, force):
         """ Update statistics for all po files from the branch """
         self.checkout()
-        domains = Domain.objects.filter(module=self.module)
+        domains = Domain.objects.filter(module=self.module).all()
         string_frozen = self.has_string_frozen()
-        for dom in domains.all():
+        for dom in domains:
             # 1. Initial settings
             # *******************
             domain_path = os.path.join(self.co_path(), dom.directory)
@@ -246,6 +246,7 @@
             elif dom.dtype == 'doc': # only gnome-doc-utils toolchain supported so far for docs
                 potfile, errs = utils.generate_doc_pot_file(domain_path, dom.potbase(), self.module.name, settings.DEBUG)
                 doclinguas = utils.read_makefile_variable(domain_path, "DOC_LINGUAS").split()
+            # else, so what?
             errors.extend(errs)
             
             # 4. Compare with old pot files, various checks

Modified: trunk/stats/utils.py
==============================================================================
--- trunk/stats/utils.py	(original)
+++ trunk/stats/utils.py	Fri Dec  5 22:21:07 2008
@@ -23,7 +23,7 @@
 from stats.conf import settings
 import sys, os, re, time, commands
 
-def sortObjectList(lst, sort_meth):
+def sort_object_list(lst, sort_meth):
     """ Sort an object list with sort_meth (which should return a translated string) """
     templist = [(getattr(obj_, sort_meth)().lower(), obj_) for obj_ in lst]
     templist.sort()

Modified: trunk/stats/views.py
==============================================================================
--- trunk/stats/views.py	(original)
+++ trunk/stats/views.py	Fri Dec  5 22:21:07 2008
@@ -37,7 +37,7 @@
     all_modules = Module.objects.all()
     context = {
         'pageSection':  "module",
-        'modules': utils.sortObjectList(all_modules, 'get_description')
+        'modules': utils.sort_object_list(all_modules, 'get_description')
     }
     return render_to_response('module_list.html', context, context_instance=RequestContext(request))
 
@@ -49,7 +49,7 @@
         'can_edit_branches': mod.can_edit_branches(request.user),
         'prof': utils.Profiler()
     }
-    return render_to_response('module.html', context, context_instance=RequestContext(request))
+    return render_to_response('module_detail.html', context, context_instance=RequestContext(request))
 
 @login_required
 def module_edit_branches(request, module_name):
@@ -148,5 +148,5 @@
         'pageSection': "releases",
         'release': rel
     }
-    return render_to_response('release.html', context, context_instance=RequestContext(request))
+    return render_to_response('release_detail.html', context, context_instance=RequestContext(request))
 



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