savannah-cvs
[Top][All Lists]
Advanced

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

[Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 6


From: Sylvain Beucler
Subject: [Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 6d429d41d577d8a617d6bd167096c19fbc65632d
Date: Sun, 14 Mar 2010 14:22:08 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Savane-cleanup framework".

The branch, master has been updated
       via  6d429d41d577d8a617d6bd167096c19fbc65632d (commit)
      from  411a3fd68ec719e929c9b37a4cf7a8abab8d0379 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=6d429d41d577d8a617d6bd167096c19fbc65632d

commit 6d429d41d577d8a617d6bd167096c19fbc65632d
Author: Sylvain Beucler <address@hidden>
Date:   Sun Mar 14 15:22:33 2010 +0100

    Trackers data structure: msgid and history; separate ID counters

diff --git a/savane/tracker/models.py b/savane/tracker/models.py
index a62b030..091c0b9 100644
--- a/savane/tracker/models.py
+++ b/savane/tracker/models.py
@@ -1,6 +1,23 @@
+# Trackers data structure
+# Copyright (C) 2010  Sylvain Beucler
+#
+# This file is part of Savane.
+# 
+# Savane is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# Savane is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 from django.db import models
 
-# Create your models here.
 class Tracker(models.Model):
     NAME_CHOICES = (('bugs', 'bugs'),
                     ('patches', 'patches'),
@@ -10,6 +27,12 @@ class Tracker(models.Model):
     name = models.CharField(max_length=7, choices=NAME_CHOICES)
 
 class Field(models.Model):
+    """
+    Fields definition for the 4 trackers (~70 fields each)
+    """
+    class Meta:
+        unique_together = (('tracker', 'name'),)
+
     DISPLAY_TYPE_CHOICES = (('DF', 'date field'),
                             ('SB', 'select box'),
                             ('TA', 'text area'),
@@ -17,7 +40,7 @@ class Field(models.Model):
     SCOPE_CHOICES = (('S', 'system'),
                      ('P', 'project'),)
 
-    tracker = models.ForeignKey("Tracker")
+    tracker = models.ForeignKey('Tracker')
     name = models.CharField(max_length=255, db_index=True)
     display_type = models.CharField(max_length=255, 
choices=DISPLAY_TYPE_CHOICES)
     display_size = models.CharField(max_length=255)
@@ -34,6 +57,12 @@ class Field(models.Model):
     custom = models.BooleanField(help_text="let the user change the label and 
description")
 
 class FieldUsage(models.Model):
+    """
+    Field configuration for each group
+    """
+    class Meta:
+        unique_together = (('bug_field', 'group'),)
+
     TRANSITION_DEFAULT_AUTH_CHOICES = (('', 'undefined'),
                                        ('A', 'allowed'),
                                        ('F', 'forbidden'),)
@@ -44,6 +73,7 @@ class FieldUsage(models.Model):
     CUSTOM_EMPTY_OK_CHOICES = (('0', 'mandatory only if it was presented to 
the original submitter'),
                                ('1', 'optional (empty values are accepted)'),
                                ('3', 'mandatory'),)
+    bug_field = models.ForeignKey('Field')
     group = models.ForeignKey('auth.Group')
     use_it = models.BooleanField("used")
     show_on_add = models.CharField(max_length=1, choices=SHOW_ON_ADD_CHOICES,
@@ -68,7 +98,7 @@ class FieldUsage(models.Model):
 
 class FieldValue(models.Model):
     """
-    Choice for a select-box (SB) field
+    Choice for a select-box (SB) field of a specific group
     """
     class Meta:
         unique_together = (('bug_field', 'group', 'value_id'),)
@@ -77,9 +107,10 @@ class FieldValue(models.Model):
                       ('H', 'hidden'), # mask previously-active or system 
fields
                       ('P', 'permanent'),) # status cannot be modified, always 
visible
     bug_field = models.ForeignKey('Field')
-    group = models.ForeignKey('auth.Group')
+    group = models.ForeignKey('auth.Group') # =100 for system-wide values
     value_id = models.IntegerField(db_index=True) # group_specific value 
identifier
-      # somehow duplicate of 'id', but might be useful when moving a bug to 
another group
+      # not a duplicate of 'id', as it's the value referenced by Item
+      # fields, and the configuration of that value can be customized 
per-project.
     value = models.CharField(max_length=255) # label
     description = models.TextField()
     order_id = models.IntegerField() # new:rank
@@ -91,11 +122,34 @@ class FieldValue(models.Model):
                                 + " in this category")
     send_all_flag = models.BooleanField("send on all updates", default=True)
 
+# Auto_increment counters
+class BugsPublicId   (models.Model): pass
+class PatchPublicId  (models.Model): pass
+class SupportPublicId(models.Model): pass
+class TaskPublicId   (models.Model): pass
 
 class Item(models.Model):
     # TODO: default '100' (aka 'nobody' or 'None', depending on
     # fields) -> change to NULL?
 
+    class Meta:
+        unique_together = (('tracker', 'bugs_id'),
+                           ('tracker', 'patch_id'),
+                           ('tracker', 'support_id'),
+                           ('tracker', 'task_id'),)
+
+    # Rename 'id' to avoid confusion with public ids below
+    internal_id = models.AutoField(primary_key=True)
+    tracker = models.ForeignKey('Tracker')
+
+    # Per-tracker public item identifier.  Reason is historical:
+    # trackers were stored in different tables, each with its own
+    # auto_increment field:
+    bugs_id    = models.ForeignKey(BugsPublicId,    blank=True, null=True)
+    task_id    = models.ForeignKey(TaskPublicId,    blank=True, null=True)
+    support_id = models.ForeignKey(SupportPublicId, blank=True, null=True)
+    patch_id   = models.ForeignKey(PatchPublicId,   blank=True, null=True)
+
     group = models.ForeignKey('auth.Group')
     spamscore = models.IntegerField(default=0)
     ip = IPAddressField(blank=True, null=True)
@@ -109,7 +163,7 @@ class Item(models.Model):
     # Note: For select boxes, FK should be limited to same group, and
     # to a specific field each e.g.:
     # severity = models.ForeignKey('FieldValue', to_field='value_id', 
default=5)
-    #            + constraint(same group) + constraint(field_name='severity')
+    #            + constraint(same group or 100) + 
constraint(field_name='severity')
     # To avoid unnecessary burden, let's drop the above incomplete ForeignKey
 
     # More generally one can wonder if this should be moved to a M2M
@@ -191,3 +245,35 @@ class Item(models.Model):
     custom_df3  = models.DateTimeField()
     custom_df4  = models.DateTimeField()
     custom_df5  = models.DateTimeField()
+
+class ItemMsgId(models.Model):
+    """
+    Idenfier for in 'Message-Id' and 'References' e-mail fields, used
+    to group messages by conversation
+    """
+    item = models.ForeignKey('Item')
+    msg_id = models.CharField(max_length=255)
+
+
+class ItemHistory(models.Model):
+    item = models.ForeignKey('Item')
+    field_name = models.CharField(max_length=255)
+       # Should be: field_name = models.ForeignKey('Field', to_field='name')
+       #            + constraint (item.tracker=field.tracker)
+       # or simply: field_name = models.ForeignKey('Field')
+       # But as it's a history field, adding constraints might be just bad.
+    old_value= models.TextField(blank=True, null=True)
+    new_value= models.TextField()
+    mod_by = models.ForeignKey('auth.User')
+    date = models.DateTimeField()
+    ip = IPAddressField(blank=True, null=True)
+
+    # Specific (bad!) field for 'details'
+    # I guess 'details' could be stored separately.
+    type = models.IntegerField("comment type", blank=True, null=True)
+      # Should be:
+      # type = models.ForeignKey('FieldValue', to_field='value_id')
+      #        + constraint(same group or 100) + 
constraint(field_name='comment_type_id')
+      # The purpose is to add <strong>[$comment_type]</strong> when
+      # displaying an item comment.
+    spamscore = models.IntegerField()

-----------------------------------------------------------------------

Summary of changes:
 savane/tracker/models.py |   98 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 92 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Savane-cleanup framework




reply via email to

[Prev in Thread] Current Thread [Next in Thread]