damned-lies r1078 - in branches/djamnedlies: . stats stats/management/commands stats/templates
- From: stephaner svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1078 - in branches/djamnedlies: . stats stats/management/commands stats/templates
- Date: Wed, 22 Oct 2008 22:25:52 +0000 (UTC)
Author: stephaner
Date: Wed Oct 22 22:25:52 2008
New Revision: 1078
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1078&view=rev
Log:
2008-10-23 StÃphane Raimbault <stephane raimbault gmail com>
* stats/management/commands/migrate.py:
* stats/models.py:
* stats/templates/module-images.tmpl:
* stats/templates/module.tmpl:
* stats/utils.py: PEP-8 but I don't want to touch Statistics and
Information for now :-/
Modified:
branches/djamnedlies/ChangeLog
branches/djamnedlies/stats/management/commands/migrate.py
branches/djamnedlies/stats/models.py
branches/djamnedlies/stats/templates/module-images.tmpl
branches/djamnedlies/stats/templates/module.tmpl
branches/djamnedlies/stats/utils.py
Modified: branches/djamnedlies/stats/management/commands/migrate.py
==============================================================================
--- branches/djamnedlies/stats/management/commands/migrate.py (original)
+++ branches/djamnedlies/stats/management/commands/migrate.py Wed Oct 22 22:25:52 2008
@@ -9,7 +9,7 @@
help = "Migrate current D-L XML files into database content"
output_transaction = False
- xml_base = "/home/claude/Bureau/TraductionsGNOME/damned-lies/trunk"
+ xml_base = "/home/stephane/src/damned-lies/"
sys.path.append(xml_base)
import data
Modified: branches/djamnedlies/stats/models.py
==============================================================================
--- branches/djamnedlies/stats/models.py (original)
+++ branches/djamnedlies/stats/models.py Wed Oct 22 22:25:52 2008
@@ -66,6 +66,7 @@
def __unicode__(self):
return self.description
+
class Language(models.Model):
name = models.CharField(max_length=50)
locale = models.CharField(max_length=15)
@@ -86,7 +87,16 @@
for rel in releases:
stats.append(rel.total_for_lang(self))
return stats
+
+VCS_TYPE_CHOICES = (
+ ('cvs', 'CVS'),
+ ('svn', 'Subversion'),
+ ('git', 'Git'),
+ ('hg', 'Mercurial'),
+ ('bzr', 'Bazaar')
+)
+
class Module(models.Model):
name = models.CharField(max_length=50)
homepage = models.URLField(null=True)
@@ -95,25 +105,22 @@
bugs_base = models.CharField(max_length=50)
bugs_product = models.CharField(max_length=50)
bugs_component = models.CharField(max_length=50)
- vcs_type = models.CharField(max_length=5, choices=(('cvs', 'CVS'),
- ('svn', 'Subversion'),
- ('git', 'Git'),
- ('hg', 'Mercurial'),
- ('bzr', 'Bazaar')))
+ vcs_type = models.CharField(max_length=5, choices=VCS_TYPE_CHOICES)
vcs_root = models.URLField()
vcs_web = models.URLField()
maintainers = models.ManyToManyField(Person, db_table='module_maintainer')
+
class Meta:
db_table = 'module'
- def get_bugs_i18nurl(self):
+ def get_bugs_i18n_url(self):
if self.bugs_base.find("bugzilla") != -1 or self.bugs_base.find("freedesktop") != -1:
return "%sbuglist.cgi?product=%s&component=%s&keywords_type=anywords&keywords=I18N+L10N&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=NEEDINFO" % (self.bugs_base, self.bugs_product, self.bugs_component)
else:
return None
- def get_bugs_enterurl(self):
+ def get_bugs_enter_url(self):
if self.bugs_base.find("bugzilla") != -1 or self.bugs_base.find("freedesktop") != -1:
return "%senter_bug.cgi?product=%s&component=%s" % (self.bugs_base, self.bugs_product, self.bugs_component)
else:
@@ -132,6 +139,7 @@
branches.sort(self.compare_branches)
return branches
+
class Branch(models.Model):
""" Branch of a module """
name = models.CharField(max_length=50)
@@ -139,6 +147,7 @@
vcs_subpath = models.CharField(max_length=50, null=True)
module = models.ForeignKey(Module)
category = models.ForeignKey('Category', null=True)
+
class Meta:
db_table = 'branch'
@@ -152,7 +161,7 @@
return True
return False
- def get_vcsurl(self):
+ def get_vcs_url(self):
if self.module.vcs_type in ('hg', 'git'):
return "%s/%s" % (self.module.vcs_root, self.module_name)
elif self.vcs_subpath:
@@ -162,7 +171,7 @@
else:
return "%s/%s/branches/%s" % (self.module.vcs_root, self.module.name, self.name)
- def get_vcsweburl(self):
+ def get_vcs_web_url(self):
if self.is_head():
return "%s/trunk" % (self.module.vcs_web)
else:
@@ -197,9 +206,10 @@
#return [obj_ for (key1, key2, obj_) in templist]
return stats
- def get_docstats(self):
+ def get_doc_stats(self):
return self.get_stats('doc')
- def get_uistats(self):
+
+ def get_ui_stats(self):
return self.get_stats('ui')
def update_stats(self, force):
@@ -344,7 +354,7 @@
})
else:
# Checkout
- vcs_path = self.get_vcsurl()
+ vcs_path = self.get_vcs_url()
if vcs_type == "cvs":
commandList.append("cd \"%(localroot)s\" && cvs -d%(cvsroot)s -z4 co -d%(dir)s -r%(branch)s %(module)s" % {
"localroot" : localroot,
@@ -406,13 +416,19 @@
else:
return 1
-
+
+DOMAIN_TYPE_CHOICES = (
+ ('ui', 'User Interface'),
+ ('doc', 'Documentation')
+)
+
class Domain(models.Model):
module = models.ForeignKey(Module)
name = models.CharField(max_length=50)
description = models.TextField(null=True)
- dtype = models.CharField(max_length=5, choices=(('ui', 'User Interface'), ('doc', 'Documentation')))
+ dtype = models.CharField(max_length=5, choices=DOMAIN_TYPE_CHOICES)
directory = models.CharField(max_length=50)
+
class Meta:
db_table = 'domain'
@@ -422,10 +438,16 @@
else:
return self.name
+RELEASE_STATUS_CHOICES = (
+ ('official', 'Official'),
+ ('unofficial', 'Unofficial'),
+ ('external', 'External')
+)
class Release(models.Model):
name = models.CharField(max_length=50)
stringfrozen = models.BooleanField()
- status = models.CharField(max_length=12, choices=(('official', 'Official'), ('unofficial', 'Unofficial'), ('external', 'External')))
+ status = models.CharField(max_length=12, choices=RELEASE_STATUS_CHOICES)
+
class Meta:
db_table = 'release'
@@ -616,6 +638,7 @@
class Category(models.Model):
release = models.ForeignKey(Release)
description = models.TextField()
+
class Meta:
db_table = 'category'
@@ -628,7 +651,7 @@
Module = models.TextField(db_column='module', null=True)
# whether this is about a document or UI translation
- Type = models.CharField(db_column='type', max_length=3, choices=(('doc', 'Documentation'), ('ui', 'User Interface')), null=True)
+ Type = models.CharField(db_column='type', max_length=3, choices=DOMAIN_TYPE_CHOICES, null=True)
Domain = models.TextField(db_column='domain', null=True)
Branch = models.TextField(db_column='branch', null=True)
Language = models.CharField(db_column='language', max_length=15, null=True)
@@ -636,6 +659,7 @@
Translated = models.IntegerField(db_column='translated', default=0)
Fuzzy = models.IntegerField(db_column='fuzzy', default=0)
Untranslated = models.IntegerField(db_column='untranslated', default=0)
+
class Meta:
db_table = 'statistics'
@@ -754,11 +778,11 @@
def vcs_path(self):
""" Return the VCS path of file on remote vcs """
- return os.path.join(self.branch.get_vcsurl(), self.domain.directory)
+ return os.path.join(self.branch.get_vcs_url(), self.domain.directory)
- def vcs_webpath(self):
+ def vcs_web_path(self):
""" Return the Web interface path of file on remote vcs """
- return os.path.join(self.branch.get_vcsweburl(), self.domain.directory)
+ return os.path.join(self.branch.get_vcs_web_url(), self.domain.directory)
def po_path(self):
""" Return path of po file on local filesystem """
@@ -838,7 +862,7 @@
class ArchivedStatistics(models.Model):
Module = models.TextField(db_column='module')
- Type = models.CharField(db_column='type', max_length=3, choices=(('doc', 'Documentation'), ('ui', 'User Interface')))
+ Type = models.CharField(db_column='type', max_length=3, choices=DOMAIN_TYPE_CHOICES)
Domain = models.TextField(db_column='domain')
Branch = models.TextField(db_column='branch')
Language = models.CharField(db_column='language', max_length=15)
@@ -846,15 +870,22 @@
Translated = models.IntegerField(db_column='translated', default=0)
Fuzzy = models.IntegerField(db_column='fuzzy', default=0)
Untranslated = models.IntegerField(db_column='untranslated', default=0)
+
class Meta:
db_table = 'archived_statistics'
-
+INFORMATION_TYPE_CHOICES = (
+ ('info', 'Information'),
+ ('warn','Warning'),
+ ('error','Error')
+)
class Information(models.Model):
Statistics = models.ForeignKey('Statistics', db_column='statistics_id')
- Type = models.CharField(db_column='type', max_length=5,
- choices=(('info', 'Information'), ('warn','Warning'), ('error','Error'))) # priority of a stats message
+ # Priority of a stats message
+ Type = models.CharField(db_column='type', max_length=5,
+ choices=INFORMATION_TYPE_CHOICES)
Description = models.TextField(db_column='description')
+
class Meta:
db_table = 'information'
@@ -876,9 +907,11 @@
class ArchivedInformation(models.Model):
Statistics = models.ForeignKey('ArchivedStatistics', db_column='statistics_id')
+ # Priority of a stats message
Type = models.CharField(db_column='type', max_length=5,
- choices=(('info', 'Information'), ('warn','Warning'), ('error','Error'))) # priority of a stats message
+ choices=INFORMATION_TYPE_CHOICES)
Description = models.TextField(db_column='description')
+
class Meta:
db_table = 'archived_information'
Modified: branches/djamnedlies/stats/templates/module-images.tmpl
==============================================================================
--- branches/djamnedlies/stats/templates/module-images.tmpl (original)
+++ branches/djamnedlies/stats/templates/module-images.tmpl Wed Oct 22 22:25:52 2008
@@ -17,17 +17,17 @@
<thead><tr><th width="50%">{% trans "Original" %}</th><th width="50%">{% trans stat.language.name %}</th></tr></thead>
{% for fig in stat.get_figures %}
{% with stat.language.locale as locale %}
- {% with stat.vcs_webpath as vcswebpath %}
- {% with stat.vcs_path as vcspath %}
+ {% with stat.vcs_web_path as vcs_web_path %}
+ {% with stat.vcs_path as vcs_path %}
<tr><td valign="top">
- <a href="{{ vcswebpath }}/C/{{ fig.path }}"><span class="path">C/{{ fig.path }}</span><br/></a>
- <a href="{{ vcspath }}/C/{{ fig.path }}"><img class="screenshot" src="{{ vcspath }}/C/{{ fig.path }}"/></a>
+ <a href="{{ vcs_web_path }}/C/{{ fig.path }}"><span class="path">C/{{ fig.path }}</span><br/></a>
+ <a href="{{ vcs_path }}/C/{{ fig.path }}"><img class="screenshot" src="{{ vcs_path }}/C/{{ fig.path }}"/></a>
</td>
<td valign="top" class="$tdclass">
{% if fig.translated %}
{% if fig.translated_file %}
- <a href="{{ vcswebpath }}/{{ locale }}/{{ fig.path }}"><span class="path">{{ locale }}/{{ fig.path }}</span></a><br/>
- <a href="{{ vcspath }}/{{ locale }}/{{ fig.path }}"><img class="screenshot" src="{{ vcspath }}/{{ locale }}/{{ fig.path }}"/></a>
+ <a href="{{ vcs_web_path }}/{{ locale }}/{{ fig.path }}"><span class="path">{{ locale }}/{{ fig.path }}</span></a><br/>
+ <a href="{{ vcs_path }}/{{ locale }}/{{ fig.path }}"><img class="screenshot" src="{{ vcs_path }}/{{ locale }}/{{ fig.path }}"/></a>
{% else %}
<p><em>{% trans "Translated, but uses original one (maybe the figure doesn't contain any string to translate)" %}</em></p>
{% endif %}
@@ -35,8 +35,8 @@
{% if fig.fuzzy %}
<em>{% trans "Fuzzy" %}</em><br/>
{% if fig.translated_file %}
- <a href="{{ vcswebpath }}/{{ locale }}/{{ fig.path }}"><span class="path">{{ locale }}/{{ fig.path }}</span></a><br/>
- <a href="{{ vcspath }}/{{ locale }}/{{ fig.path }}"><img class="screenshot" src="{{ vcspath }}/{{ locale }}/{{ fig.path }}"/></a>
+ <a href="{{ vcs_web_path }}/{{ locale }}/{{ fig.path }}"><span class="path">{{ locale }}/{{ fig.path }}</span></a><br/>
+ <a href="{{ vcs_path }}/{{ locale }}/{{ fig.path }}"><img class="screenshot" src="{{ vcs_path }}/{{ locale }}/{{ fig.path }}"/></a>
{% else %}
<p><em><small>{% trans "No existing file ("Technical" fuzzy)" %}</small></em></p>
{% endif %}
Modified: branches/djamnedlies/stats/templates/module.tmpl
==============================================================================
--- branches/djamnedlies/stats/templates/module.tmpl (original)
+++ branches/djamnedlies/stats/templates/module.tmpl Wed Oct 22 22:25:52 2008
@@ -41,10 +41,10 @@
{% if module.bugs_base %}
<h2>{% trans "Bug reporting" %}</h2>
<ul>
- {% if module.get_bugs_i18nurl %}
- <li><a href="{{ module.get_bugs_i18nurl }}">{% trans "Show existing i18n and l10n bugs" %}</li>
+ {% if module.get_bugs_i18n_url %}
+ <li><a href="{{ module.get_bugs_i18n_url }}">{% trans "Show existing i18n and l10n bugs" %}</li>
{% endif %}
- <li><a href="{{ module.get_bugs_enterurl }}">{% trans "Report bugs to Bugzilla" %}</a></li>
+ <li><a href="{{ module.get_bugs_enter_url }}">{% trans "Report bugs to Bugzilla" %}</a></li>
</ul>
{% endif %}
@@ -65,10 +65,10 @@
{% for branch in module.get_branches %}
<h2><a name="{{ branch.name }}"></a>{{ branch.name }}
{% ifequal module.vcs_type "cvs" %}
- (<a href="{{ branch.get_vcsweburl }}">{% trans "Browse CVS" %}</a>)
+ (<a href="{{ branch.get_vcs_web_url }}">{% trans "Browse CVS" %}</a>)
{% endifequal %}
{% ifequal module.vcs_type "svn" %}
- (<a href="{{ branch.get_vcsweburl }}">{% trans "Browse SVN" %}</a>)
+ (<a href="{{ branch.get_vcs_web_url }}">{% trans "Browse SVN" %}</a>)
{% endifequal %}
</h2>
{% if branch.release_cat.release.stringfrozen %}
@@ -76,7 +76,7 @@
{% endif %}
<table><tr><td valign="top"><!-- split to two columns -->
- {% with branch.get_docstats as stats %}
+ {% with branch.get_doc_stats as stats %}
{% if stats|length %}
<h3>{% trans "Documentation" %}</h3>
{% include "show-stats.tmpl" %}
@@ -84,7 +84,7 @@
{% endwith %}
</td><td valign="top"><!-- split to two columns -->
- {% with branch.get_uistats as stats %}
+ {% with branch.get_ui_stats as stats %}
{% if stats|length %}
<h3>{% trans "Translation" %}</h3>
{% include "show-stats.tmpl" %}
Modified: branches/djamnedlies/stats/utils.py
==============================================================================
--- branches/djamnedlies/stats/utils.py (original)
+++ branches/djamnedlies/stats/utils.py Wed Oct 22 22:25:52 2008
@@ -77,18 +77,18 @@
+ "</li>\n</ul>")))
return errors
-def generate_pot_file(vcspath, potbase, verbose):
+def generate_pot_file(vcs_path, potbase, verbose):
""" Return the pot file generated or empty string on error """
command = "cd \"%(dir)s\" && intltool-update -g '%(domain)s' -p" % {
- "dir" : vcspath,
+ "dir" : vcs_path,
"domain" : potbase,
}
if verbose: print >>sys.stderr, command
(error, output) = commands.getstatusoutput(command)
if verbose: print >> sys.stderr, output
- potfile = os.path.join(vcspath, potbase + ".pot")
+ potfile = os.path.join(vcs_path, potbase + ".pot")
if error or not os.access(potfile, os.R_OK):
return ""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]