damned-lies r1086 - in branches/djamnedlies: . stats stats/conf stats/management/commands templates



Author: claudep
Date: Thu Oct 23 08:57:30 2008
New Revision: 1086
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1086&view=rev

Log:
2008-10-23  Claude Paroz  <claude 2xlibre net>

	* README: Add stats/conf/settings.py notice.
	* stats/conf/settings.py: Remove my local paths
	* stats/management/commands/migrate.py: Take xml_base value from settings.
	Don't import nobody.png in database.
	* stats/urls.py: Take static document_root from settings.
	* templates/person-base.html: nobody.png is not any more in DB.

Modified:
   branches/djamnedlies/ChangeLog
   branches/djamnedlies/README
   branches/djamnedlies/stats/conf/settings.py
   branches/djamnedlies/stats/management/commands/migrate.py
   branches/djamnedlies/stats/urls.py
   branches/djamnedlies/templates/person-base.html

Modified: branches/djamnedlies/README
==============================================================================
--- branches/djamnedlies/README	(original)
+++ branches/djamnedlies/README	Thu Oct 23 08:57:30 2008
@@ -15,3 +15,4 @@
 ============
 
 1 - Rename settings_sample.py in settings.py
+2 - Review and fill in settings in stats/conf/settings.py 

Modified: branches/djamnedlies/stats/conf/settings.py
==============================================================================
--- branches/djamnedlies/stats/conf/settings.py	(original)
+++ branches/djamnedlies/stats/conf/settings.py	Thu Oct 23 08:57:30 2008
@@ -10,6 +10,8 @@
 NOTIFICATIONS_TO = 'gnome-i18n gnome org'
 
 # Local directories
-SCRATCHDIR = "/home/claude/www/damned-lies/cvs/"
+SCRATCHDIR = ""
 POTDIR = os.path.join(SCRATCHDIR, "POT")
 
+# Used for migration
+OLD_DAMNEDLIES = ""

Modified: branches/djamnedlies/stats/management/commands/migrate.py
==============================================================================
--- branches/djamnedlies/stats/management/commands/migrate.py	(original)
+++ branches/djamnedlies/stats/management/commands/migrate.py	Thu Oct 23 08:57:30 2008
@@ -2,6 +2,7 @@
 import sys
 from django.core.management.base import BaseCommand
 from stats.models import Person, Team, Language, Module, Branch, Domain, Release, Category, Statistics
+from stats.conf import settings
 
 class Command(BaseCommand):
     """ Before the migration, set the xml_base directory to a legacy Damned Lies checkout """
@@ -9,13 +10,12 @@
     help = "Migrate current D-L XML files into database content"
 
     output_transaction = False
-    xml_base = "/home/stephane/src/damned-lies/"
+    xml_base = settings.OLD_DAMNEDLIES
     sys.path.append(xml_base)
     import data
 
     def handle(self, **options):
-        #drop table language;drop table module;drop table module_maintainer;drop table person;drop table release;drop table category;drop table team;drop table branch;
-        
+                
         print self.migratePeople()
         print self.migrateTeams()
         print self.migrateModules()
@@ -45,13 +45,17 @@
             last_name = ' '.join(l_name[1:])
             # Claude, please have a look at this and the username (unique key)
             print "Name '%s' becomes '%s' and '%s'" % (p['name'], first_name, last_name)
+            if p['icon'] == "/data/nobody.png":
+                p['icon'] = None
             new_p = Person(_old_id=p['id'],
                            username=p['svn-account'] or p['email'][:30],
                            first_name=l_name[0],
                            last_name=' '.join(l_name[1:]), 
                            email=p['email'],
-                           svn_account=p['svn-account'], image=p['icon'], 
-                           webpage_url=p['webpage'], irc_nick=p['nick'], 
+                           svn_account=p['svn-account'],
+                           image=p['icon'], 
+                           webpage_url=p['webpage'],
+                           irc_nick=p['nick'], 
                            bugzilla_account=p['bugzilla-account'])
             new_p.save()
         return "People migrated successfully"

Modified: branches/djamnedlies/stats/urls.py
==============================================================================
--- branches/djamnedlies/stats/urls.py	(original)
+++ branches/djamnedlies/stats/urls.py	Thu Oct 23 08:57:30 2008
@@ -1,4 +1,5 @@
 from django.conf.urls.defaults import *
+from stats.conf import settings
 
 # Uncomment the next two lines to enable the admin:
 from django.contrib import admin
@@ -22,5 +23,5 @@
     # Static files (should be replaced by web server redirection in production
 urlpatterns += patterns('',
     (r'^POT/(?P<path>.*)$', 'django.views.static.serve',
-     {'document_root': '/home/claude/www/damned-lies/cvs/POT'}),
+     {'document_root': settings.POTDIR}),
 )

Modified: branches/djamnedlies/templates/person-base.html
==============================================================================
--- branches/djamnedlies/templates/person-base.html	(original)
+++ branches/djamnedlies/templates/person-base.html	Thu Oct 23 08:57:30 2008
@@ -5,11 +5,11 @@
 {% load i18n %}
 
   <div class="maintainer">
-  {% ifnotequal person.image '/media/img/nobody.png' %}
+  {% if person.image %}
     <img class="people" src="{{ person.image }}" alt="{{ person.name }}" />
   {% else %}
     <img class="people" src="/media/img/nobody.png" alt="" />
-  {% endifnotequal %}
+  {% endif %}
 
   <a style="font-size: 140%;" href="{{ webroot }}/people/{{ person.id }}">{{ person.name }}</a><br />
 



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