notes for future improvement
authorJeff Hammel <jhammel@mozilla.com>
Thu, 20 May 2010 17:46:28 -0700
changeset 35 c2bc5978162fe14631fdb96492aa351908c4e712
parent 34 15ea9fa728adc07d10479e4c939b100102be15af
child 36 2cb2ecad3649fe738a77ad946fbcb4673dc4f320
push id6
push userjhammel@mozilla.com
push dateFri, 21 May 2010 16:35:23 +0000
notes for future improvement
topfails/viewer/models.py
--- a/topfails/viewer/models.py
+++ b/topfails/viewer/models.py
@@ -63,16 +63,18 @@ class BuildStatus():
 BUILDSTATUS_CHOICES = (
     (BuildStatus.Success, 'Success'),
     (BuildStatus.TestFailed, 'Test Failed'),
     (BuildStatus.Burning, 'Burning'),
     (BuildStatus.Exception, 'Exception'),
     (BuildStatus.Unknown, 'Unknown')
 )
 
+# TODO: check max_length from actual data and, preferably, figure out
+# some way how to get this semi-dynamically
 
 class Tree(models.Model):
     id = models.AutoField(primary_key=True)
     name = models.CharField(max_length=45, blank=True)
     
     def __unicode__(self):
       return self.name
     
@@ -82,20 +84,21 @@ class Build(models.Model):
     tree = models.ForeignKey(Tree)
     starttime = models.IntegerField(null=True, blank=True)
     status = models.IntegerField(choices=BUILDSTATUS_CHOICES)
     changeset = models.CharField(max_length=80,blank=True)
     logfile = models.CharField(max_length=300,blank=True)
     
     def startdate(self):
         return datetime.fromtimestamp(self.starttime)
-    
+
+    # TODO: links should not live in the model;  that completely
+    # violates the principle of MVC!
+
     def changesetlink(self):
-      # TODO: links should not live in the model;  that completely
-      # violates the principle of MVC!
       if str(self.tree)  == 'Firefox':
         return '<a href="%s/rev/%s">%s</a>' % ("http://hg.mozilla.org/mozilla-central", self.changeset, self.changeset)
       elif str(self.tree) == 'Firefox3.6':
         return '<a href="%s/rev/%s">%s</a>' % ("http://hg.mozilla.org/releases/mozilla-1.9.2", self.changeset, self.changeset)
       elif str(self.tree) == 'Thunderbird' or str(self.tree) == 'SeaMonkey':  
         return '<a href="%s/rev/%s">%s</a>' % ("http://hg.mozilla.org/comm-central", self.changeset, self.changeset)
       else :
         return '<a href="%s/rev/%s">%s</a>' % ("http://hg.mozilla.org/mozilla-central", self.changeset, self.changeset)