incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1424271 - /incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/model.py
Date Thu, 20 Dec 2012 02:29:28 GMT
Author: gjm
Date: Thu Dec 20 02:29:28 2012
New Revision: 1424271

URL: http://svn.apache.org/viewvc?rev=1424271&view=rev
Log:
adding the ability to output schema to ModelBase in terms of trac's Table and Column for consistency
of dump generation across trac and bh schema - towards #314

Modified:
    incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/model.py

Modified: incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/model.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/model.py?rev=1424271&r1=1424270&r2=1424271&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/model.py (original)
+++ incubator/bloodhound/trunk/bloodhound_dashboard/bhdashboard/model.py Thu Dec 20 02:29:28
2012
@@ -16,6 +16,7 @@
 #  specific language governing permissions and limitations
 #  under the License.
 
+from trac.db import Table, Column
 from trac.core import TracError
 from trac.resource import ResourceNotFound
 from trac.ticket.api import TicketSystem
@@ -224,4 +225,14 @@ class ModelBase(object):
             model.__init__(env, data)
             rows.append(model)
         return rows
+    
+    @classmethod
+    def _get_fields(cls):
+        return cls._meta['key_fields']+cls._meta['non_key_fields']
+    
+    @classmethod
+    def _get_schema(cls):
+        fields =  [Column(field) for field in cls._get_fields()]
+        return Table(cls._meta['table_name'], key=set(cls._meta['key_fields'] +
+                            cls._meta['unique_fields'])) [fields]
 



Mime
View raw message