damned-lies r1180 - in trunk: . stats templates
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1180 - in trunk: . stats templates
- Date: Wed, 19 Nov 2008 09:56:26 +0000 (UTC)
Author: claudep
Date: Wed Nov 19 09:56:26 2008
New Revision: 1180
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1180&view=rev
Log:
2008-11-19 Claude Paroz <claude 2xlibre net>
* stats/utils.py: sortObjectList uses a method to get sorting key, which
is more flexible.
* stats/views.py: Pass a method to sortObjectList.
* templates/module_list.html: Use module.get_description for translated
name.
Modified:
trunk/ChangeLog
trunk/stats/utils.py
trunk/stats/views.py
trunk/templates/module_list.html
Modified: trunk/stats/utils.py
==============================================================================
--- trunk/stats/utils.py (original)
+++ trunk/stats/utils.py Wed Nov 19 09:56:26 2008
@@ -23,11 +23,9 @@
from stats.conf import settings
import sys, os, re, time, commands
-def sortObjectList(lst, tr_field):
- """ Sort an object list with translated_name """
- for l in lst:
- l.translated_name = _(getattr(l, tr_field))
- templist = [(obj_.translated_name.lower(), obj_) for obj_ in lst]
+def sortObjectList(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()
return [obj_ for (key1, obj_) in templist]
Modified: trunk/stats/views.py
==============================================================================
--- trunk/stats/views.py (original)
+++ trunk/stats/views.py Wed Nov 19 09:56:26 2008
@@ -33,7 +33,7 @@
all_modules = Module.objects.all()
context = {
'pageSection': "module",
- 'modules': utils.sortObjectList(all_modules, 'description')
+ 'modules': utils.sortObjectList(all_modules, 'get_description')
}
return render_to_response('module_list.html', context)
Modified: trunk/templates/module_list.html
==============================================================================
--- trunk/templates/module_list.html (original)
+++ trunk/templates/module_list.html Wed Nov 19 09:56:26 2008
@@ -13,7 +13,7 @@
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3">
<ul class="foot">
{% for mod in modules %}
- <li><a href="{% url stats.views.module mod.name %}">{{ mod.translated_name }} </a></li>
+ <li><a href="{% url stats.views.module mod.name %}">{{ mod.get_description }} </a></li>
{% endfor %}
</ul>
</div>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]