damned-lies r1141 - in branches/djamnedlies: . docs languages people stats teams templates/languages templates/teams
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1141 - in branches/djamnedlies: . docs languages people stats teams templates/languages templates/teams
- Date: Sat, 8 Nov 2008 13:26:06 +0000 (UTC)
Author: claudep
Date: Sat Nov 8 13:26:06 2008
New Revision: 1141
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1141&view=rev
Log:
2008-11-08 Claude Paroz <claude 2xlibre net>
* languages/models.py: get_name/get_team_url API addition.
* languages/urls.py: Permit '@' in urls for language.
* people/models.py: Remove deprecated _old_id.
* stats/models.py: Temporary fix for ooo-build speciality. Replace
external by xternal for ordering purposes.
* teams/models.py: Added get_languages method, and FakeTeam class to
provide for locales without team.
* teams/urls.py:
* teams/views.py: Replaced generic view by a normal view to handle
FakeTeam teams.
* templates/languages/language_list.html: Use new get_team_url/get_name
methods.
* templates/teams/team_detail.html: Adapted to handle FakeTeam use case.
Modified:
branches/djamnedlies/ChangeLog
branches/djamnedlies/docs/DataModel.odg
branches/djamnedlies/languages/models.py
branches/djamnedlies/languages/urls.py
branches/djamnedlies/people/models.py
branches/djamnedlies/stats/models.py
branches/djamnedlies/teams/models.py
branches/djamnedlies/teams/urls.py
branches/djamnedlies/teams/views.py
branches/djamnedlies/templates/languages/language_list.html
branches/djamnedlies/templates/teams/team_detail.html
Modified: branches/djamnedlies/docs/DataModel.odg
==============================================================================
Binary files. No diff available.
Modified: branches/djamnedlies/languages/models.py
==============================================================================
--- branches/djamnedlies/languages/models.py (original)
+++ branches/djamnedlies/languages/models.py Sat Nov 8 13:26:06 2008
@@ -1,5 +1,6 @@
from django.db import models
-from teams.models import Team
+from django.utils.translation import ugettext as _
+from teams.models import Team, FakeTeam
class Language(models.Model):
name = models.CharField(max_length=50, unique=True)
@@ -25,6 +26,12 @@
return loc_string.replace('_at_', '@')
return None
+ def get_name(self):
+ if self.name:
+ return _(self.name)
+ else:
+ return self.locale
+
def bugs_url_enter(self):
return "http://bugzilla.gnome.org/enter_bug.cgi?product=l10n&component=%s%%20[%s]" % (self.name, self.locale)
@@ -41,3 +48,9 @@
for rel in releases:
stats.append(rel.total_for_lang(self))
return stats
+
+ def get_team_url(self):
+ if self.team:
+ return self.team.get_absolute_url()
+ else:
+ return FakeTeam(self).get_absolute_url()
Modified: branches/djamnedlies/languages/urls.py
==============================================================================
--- branches/djamnedlies/languages/urls.py (original)
+++ branches/djamnedlies/languages/urls.py Sat Nov 8 13:26:06 2008
@@ -2,5 +2,5 @@
urlpatterns = patterns('',
url(r'^$', 'languages.views.languages', name='languages'),
- url(r'(?P<locale>[\w-]+)/(?P<release_name>[\w-]+)/$', 'languages.views.language_release', name='language_release'),
+ url(r'(?P<locale>[\w\- ]+)/(?P<release_name>[\w-]+)/$', 'languages.views.language_release', name='language_release'),
)
Modified: branches/djamnedlies/people/models.py
==============================================================================
--- branches/djamnedlies/people/models.py (original)
+++ branches/djamnedlies/people/models.py Sat Nov 8 13:26:06 2008
@@ -9,10 +9,6 @@
class Person(User):
""" The User class of D-L. """
- # Deprecated - This field will be removed after the first
- # production deployment
- _old_id = models.CharField(max_length=50, blank=True)
-
svn_account = models.SlugField(max_length=20, null=True, blank=True)
image = models.URLField(null=True, blank=True)
webpage_url = models.URLField(null=True, blank=True)
Modified: branches/djamnedlies/stats/models.py
==============================================================================
--- branches/djamnedlies/stats/models.py (original)
+++ branches/djamnedlies/stats/models.py Sat Nov 8 13:26:06 2008
@@ -311,7 +311,8 @@
flist = []
if domain.dtype == "ui":
for f in os.listdir(dom_path):
- if f[-3:] != ".po":
+ # FIXME: temporary fix for ooo-build module (see #551328)
+ if f[-3:] != ".po" or f[:4] == "ooo-":
continue
lang = f[:-3]
pofile = os.path.join(dom_path, f)
@@ -454,7 +455,7 @@
RELEASE_STATUS_CHOICES = (
('official', 'Official'),
('unofficial', 'Unofficial'),
- ('external', 'External')
+ ('xternal', 'External')
)
class Release(models.Model):
name = models.SlugField(max_length=20)
Modified: branches/djamnedlies/teams/models.py
==============================================================================
--- branches/djamnedlies/teams/models.py (original)
+++ branches/djamnedlies/teams/models.py Sat Nov 8 13:26:06 2008
@@ -20,6 +20,7 @@
from django.db import models
from django.contrib.auth.models import Group
+from django.utils.translation import ugettext as _
from people.models import Person
class Team(Group):
@@ -43,3 +44,23 @@
@models.permalink
def get_absolute_url(self):
return ('team_slug', [self.name])
+
+ def get_languages(self):
+ return self.language_set.all()
+
+class FakeTeam(object):
+ """ This is a class replacing a Team object when a language
+ has no team attached """
+ fake = 1
+
+ def __init__(self, language):
+ self.language = language
+ self.description = _("No team for locale %s") % self.language.locale
+
+ def get_absolute_url(self):
+ # FIXME: try to avoid using a hard-coded link
+ return "/teams/%s" % self.language.locale
+
+ def get_languages(self):
+ return (self.language,)
+
Modified: branches/djamnedlies/teams/urls.py
==============================================================================
--- branches/djamnedlies/teams/urls.py (original)
+++ branches/djamnedlies/teams/urls.py Sat Nov 8 13:26:06 2008
@@ -13,5 +13,6 @@
urlpatterns = patterns('',
url(r'^$', 'teams.views.teams', name='teams'),
url(r'(?P<object_id>\d+)', 'django.views.generic.list_detail.object_detail', dict(info_dict), 'team'),
- url(r'(?P<slug>\w+)', 'django.views.generic.list_detail.object_detail', dict(info_dict), 'team_slug'),
+ #url(r'(?P<slug>\w+)', 'django.views.generic.list_detail.object_detail', dict(info_dict), 'team_slug'),
+ url(r'(?P<team_slug>[\w\- ]+)', 'teams.views.team', name='team_slug'),
)
Modified: branches/djamnedlies/teams/views.py
==============================================================================
--- branches/djamnedlies/teams/views.py (original)
+++ branches/djamnedlies/teams/views.py Sat Nov 8 13:26:06 2008
@@ -21,7 +21,8 @@
from django.shortcuts import render_to_response
from common import utils
-from teams.models import Team
+from teams.models import Team, FakeTeam
+from languages.models import Language
def teams(request):
teams = Team.objects.all()
@@ -31,3 +32,17 @@
'teams': utils.trans_sort_object_list(teams, 'description')
}
return render_to_response('teams/team_list.html', context)
+
+def team(request, team_slug):
+ try:
+ team = Team.objects.get(name=team_slug)
+ except:
+ lang = Language.objects.get(locale=team_slug)
+ team = FakeTeam(lang)
+
+ context = {
+ 'pageSection': 'teams',
+ 'team': team
+ }
+ return render_to_response('teams/team_detail.html', context)
+
Modified: branches/djamnedlies/templates/languages/language_list.html
==============================================================================
--- branches/djamnedlies/templates/languages/language_list.html (original)
+++ branches/djamnedlies/templates/languages/language_list.html Sat Nov 8 13:26:06 2008
@@ -18,11 +18,7 @@
<ul class="foot">
{% for lang in languages %}
<li style="font-size: 120%;">
- {% if lang.name %}
- <a href="{{ lang.team.get_absolute_url }}">{{ lang.translated_name }}</a>
- {% else %}
- <a href="{{ lang.team.get_absolute_url }}">{{ lang.locale }}</a>
- {% endif %}
+ <a href="{{ lang.get_team_url }}">{{ lang.get_name }}</a>
</li>
{% endfor %}
</ul>
Modified: branches/djamnedlies/templates/teams/team_detail.html
==============================================================================
--- branches/djamnedlies/templates/teams/team_detail.html (original)
+++ branches/djamnedlies/templates/teams/team_detail.html Sat Nov 8 13:26:06 2008
@@ -6,9 +6,9 @@
{% block content %}
<div class="mainpage">
+{% if not team.fake %}
<h1>{% blocktrans with team.description as lang %}{{ lang }} Translation Team{% endblocktrans %}</h1>
-
<table><tr><td valign="top" width="50%">
<h2>{% trans "Details" %}</h2>
@@ -19,8 +19,10 @@
<br/><strong>{% trans "Bugzilla:" %}</strong>
<ul>
+ {% with team.get_languages.0 as language %}
<li><a href="{{ language.bugs_url_enter|safe }}">{% trans "Report Bug in Translation" %}</a></li>
<li><a href="{{ language.bugs_url_show|safe }}">{% trans "Show Existing Bugs" %}</a></li>
+ {% endwith %}
</ul>
{% if team.mailing_list %}
@@ -43,8 +45,11 @@
{% endwith %}
{% endif %}
</td></tr></table>
+{% else %}
+<h1>{{ team.description }}</h1>
+{% endif %}
-{% for lang in team.language_set.all %}
+{% for lang in team.get_languages %}
<h2>{% trans lang.name %}</h2>
<table class="stats">
<thead><tr><th>{% trans "Release" %}</th><th>{% trans "Documentation" %}</th><th>{% trans "Graph" %}</th>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]