damned-lies r1137 - in branches/djamnedlies: . people stats stats/management/commands
- From: claudep svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1137 - in branches/djamnedlies: . people stats stats/management/commands
- Date: Fri, 7 Nov 2008 15:15:13 +0000 (UTC)
Author: claudep
Date: Fri Nov 7 15:15:13 2008
New Revision: 1137
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1137&view=rev
Log:
2008-11-07 Claude Paroz <claude 2xlibre net>
* people/models.py: Permit users without passwords (or '!').
* settings_sample.py: Make admin media a subdir of media.
* stats/management/commands/update-stats.py: Fixed typo.
* stats/models.py: Replace default=None by blank=True in models.
* urls.py:
* stats/urls.py: Moved urls in /urls.py so as /module and /release urls
are in the root.
Removed:
branches/djamnedlies/stats/urls.py
Modified:
branches/djamnedlies/ChangeLog
branches/djamnedlies/people/models.py
branches/djamnedlies/settings_sample.py
branches/djamnedlies/stats/management/commands/update-stats.py
branches/djamnedlies/stats/models.py
branches/djamnedlies/urls.py
Modified: branches/djamnedlies/people/models.py
==============================================================================
--- branches/djamnedlies/people/models.py (original)
+++ branches/djamnedlies/people/models.py Fri Nov 7 15:15:13 2008
@@ -1,5 +1,5 @@
from django.db import models
-from django.contrib.auth.models import User
+from django.contrib.auth.models import User, UserManager
def obfuscate_email(email):
if email:
@@ -11,17 +11,26 @@
# Deprecated - This field will be removed after the first
# production deployment
- _old_id = models.CharField(max_length=50, default=None)
-
- svn_account = models.SlugField(max_length=20, null=True, default=None)
- image = models.URLField(null=True, default=None)
- webpage_url = models.URLField(null=True, default=None)
- irc_nick = models.SlugField(max_length=20, null=True, default=None)
- bugzilla_account = models.SlugField(null=True, default=None)
+ _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)
+ irc_nick = models.SlugField(max_length=20, null=True, blank=True)
+ bugzilla_account = models.SlugField(null=True, blank=True)
+
+ # Use UserManager to get the create_user method, etc.
+ objects = UserManager()
+
class Meta:
db_table = 'person'
+ def save(self):
+ if not self.password or self.password == "!":
+ self.password = None
+ self.set_unusable_password()
+ super(User, self).save()
+
def no_spam_email(self):
return obfuscate_email(self.email)
Modified: branches/djamnedlies/settings_sample.py
==============================================================================
--- branches/djamnedlies/settings_sample.py (original)
+++ branches/djamnedlies/settings_sample.py Fri Nov 7 15:15:13 2008
@@ -62,7 +62,7 @@
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/admin_media/'
+ADMIN_MEDIA_PREFIX = '/media/admin/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'zk!^92901p458c8lo0(fox-&k7jj(aple76_k%eva7b1)xjo8-'
Modified: branches/djamnedlies/stats/management/commands/update-stats.py
==============================================================================
--- branches/djamnedlies/stats/management/commands/update-stats.py (original)
+++ branches/djamnedlies/stats/management/commands/update-stats.py Fri Nov 7 15:15:13 2008
@@ -38,7 +38,7 @@
modules = Module.objects.all()
for mod in modules:
print "Updating stats for %s..." % (mod.name)
- branches = Branch.objects.filter(module__name=modu)
+ branches = Branch.objects.filter(module__name=mod)
for branch in branches.all():
branch.update_stats(options['force'])
else:
Modified: branches/djamnedlies/stats/models.py
==============================================================================
--- branches/djamnedlies/stats/models.py (original)
+++ branches/djamnedlies/stats/models.py Fri Nov 7 15:15:13 2008
@@ -40,9 +40,9 @@
class Module(models.Model):
name = models.CharField(max_length=50)
- homepage = models.URLField(null=True, default=None)
- description = models.TextField(null=True, default=None)
- comment = models.TextField(null=True, default=None)
+ homepage = models.URLField(null=True, blank=True)
+ description = models.TextField(null=True, blank=True)
+ comment = models.TextField(null=True, blank=True)
bugs_base = models.CharField(max_length=50)
bugs_product = models.CharField(max_length=50)
bugs_component = models.CharField(max_length=50)
@@ -51,7 +51,7 @@
vcs_web = models.URLField()
maintainers = models.ManyToManyField(Person, db_table='module_maintainer',
- related_name='maintains_modules')
+ related_name='maintains_modules', blank=True)
class Meta:
db_table = 'module'
@@ -94,7 +94,7 @@
""" Branch of a module """
name = models.CharField(max_length=50)
#description = models.TextField(null=True)
- vcs_subpath = models.CharField(max_length=50, null=True, default=None)
+ vcs_subpath = models.CharField(max_length=50, null=True, blank=True)
module = models.ForeignKey(Module)
# 'releases' is the backward relation name from Release model
@@ -106,6 +106,11 @@
def __unicode__(self):
return "%s (%s)" % (self.name, self.module)
+ def save(self):
+ super(Branch, self).save()
+ #FIXME: this command should be run in a separate thread
+ self.update_stats(force=True)
+
def is_head(self):
if self.module.vcs_type in ('cvs', 'svn') and self.name == "HEAD":
return True
@@ -245,9 +250,9 @@
except:
stat = Statistics(language = None, branch = self, domain = dom, translated = 0,
fuzzy = 0, untranslated = int(pot_stats['untranslated']))
+ stat.save()
for err in errors:
stat.information_set.add(Information(Type=err[0], Description=err[1]))
- stat.save()
# Update po files and update DB with new stats
command = "msgmerge -o %(outpo)s %(pofile)s %(potfile)s"
@@ -277,7 +282,7 @@
# Save in DB
try:
stat = Statistics.objects.get(language__locale=lang, branch=self, domain=dom)
- stat.translated = int(langstats['untranslated'])
+ stat.translated = int(langstats['translated'])
stat.fuzzy = int(langstats['fuzzy'])
stat.untranslated = int(langstats['untranslated'])
stat.date = datetime.now()
@@ -420,7 +425,7 @@
class Domain(models.Model):
module = models.ForeignKey(Module)
name = models.CharField(max_length=50)
- description = models.TextField(null=True, default=None)
+ description = models.TextField(null=True, blank=True)
dtype = models.CharField(max_length=5, choices=DOMAIN_TYPE_CHOICES, default='ui')
directory = models.CharField(max_length=50)
@@ -445,7 +450,8 @@
('external', 'External')
)
class Release(models.Model):
- name = models.CharField(max_length=50)
+ name = models.SlugField(max_length=20)
+ description = models.CharField(max_length=50)
stringfrozen = models.BooleanField(default=False)
status = models.CharField(max_length=12, choices=RELEASE_STATUS_CHOICES)
branches = models.ManyToManyField(Branch, through='Category', related_name='releases')
Modified: branches/djamnedlies/urls.py
==============================================================================
--- branches/djamnedlies/urls.py (original)
+++ branches/djamnedlies/urls.py Fri Nov 7 15:15:13 2008
@@ -4,25 +4,23 @@
admin.autodiscover()
-# To try to respect http://www.w3.org/Provider/Style/URI
-# The following URL must be added:
-
-# - /languages/<name> (not sure, redirects on team)
-
-# - /module/ -> all
-# - /module/<name>
-# - /releases/ -> all
-# - /releases/<id>
-
urlpatterns = patterns('',
url(r'^$', 'common.views.index', name='home'),
(r'^teams/', include('teams.urls')),
(r'^people/', include('people.urls')),
(r'^languages/', include('languages.urls')),
- (r'^stats/', include('stats.urls')),
+ #(r'^stats/', include('stats.urls')),
(r'^admin/(.*)', admin.site.root),
)
+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'),
+ url(r'^releases/$', 'releases', name='releases'),
+ (r'^releases/(?P<release_id>\d+)$', 'release'),
+)
+
if settings.STATIC_SERVE:
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]