You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by ju...@apache.org on 2013/02/19 14:29:55 UTC

svn commit: r1447714 - in /incubator/bloodhound/branches/bep_0003_multiproduct: ./ bloodhound_dashboard/bhdashboard/widgets/ bloodhound_multiproduct/tests/ bloodhound_theme/bhtheme/htdocs/js/ bloodhound_theme/bhtheme/templates/

Author: jure
Date: Tue Feb 19 13:29:55 2013
New Revision: 1447714

URL: http://svn.apache.org/r1447714
Log:
Sync merge from trunk


Modified:
    incubator/bloodhound/branches/bep_0003_multiproduct/   (props changed)
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_dashboard/bhdashboard/widgets/timeline.py
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/model.py
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/htdocs/js/theme.js
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_milestone_edit.html
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_query.html
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_report_view.html
    incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html

Propchange: incubator/bloodhound/branches/bep_0003_multiproduct/
------------------------------------------------------------------------------
  Merged /incubator/bloodhound/trunk:r1446486-1447710

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_dashboard/bhdashboard/widgets/timeline.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_dashboard/bhdashboard/widgets/timeline.py?rev=1447714&r1=1447713&r2=1447714&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_dashboard/bhdashboard/widgets/timeline.py (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_dashboard/bhdashboard/widgets/timeline.py Tue Feb 19 13:29:55 2013
@@ -161,21 +161,22 @@ class TimelineWidget(WidgetBase):
             if start is not None:
                 fakereq.args['from'] = start.strftime('%x %X')
 
+            wcontext = context.child()
             if (realm, rid) != (None, None):
                 # Override rendering context
                 resource = Resource(realm, rid)
                 if resource_exists(self.env, resource) or \
                         realm == rid == '':
-                    context = RenderingContext(resource)
-                    context.req = req
+                    wcontext = context.child(resource)
+                    wcontext.req = req
                 else:
                     self.log.warning("TimelineWidget: Resource %s not found",
                             resource)
             # FIXME: Filter also if existence check is not conclusive ?
-            if resource_exists(self.env, context.resource):
-                module = FilteredTimeline(self.env, context)
+            if resource_exists(self.env, wcontext.resource):
+                module = FilteredTimeline(self.env, wcontext)
                 self.log.debug('Filtering timeline events for %s', \
-                        context.resource)
+                        wcontext.resource)
             else:
                 module = timemdl
             data = module.process_request(fakereq)[1]
@@ -188,7 +189,10 @@ class TimelineWidget(WidgetBase):
                         exclude=["stylesheet", "alternate"])
             data['today'] = today = datetime.now(req.tz)
             data['yesterday'] = today - timedelta(days=1)
-            data['context'] = context
+            if 'context' in data:
+                # Needed for abbreviated messages in widget events (#340)
+                wcontext.set_hints(**(data['context']._hints or {}))
+            data['context'] = wcontext
             return 'widget_timeline.html', \
                     {
                         'title' : _('Activity'),

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/model.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/model.py?rev=1447714&r1=1447713&r2=1447714&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/model.py (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/model.py Tue Feb 19 13:29:55 2013
@@ -176,6 +176,36 @@ class ProductTestCase(unittest.TestCase)
         product.description = new_description
         self.assertEqual(new_description, product.description)
 
+    def test_missing_unique_fields(self):
+        """ensure that that insert method works when _meta does not specify
+        unique fields when inserting more than one ProductResourceMap instances
+        """
+        from multiproduct.model import ModelBase
+        class TestModel(ModelBase):
+            """A test model with no unique_fields"""
+            _meta = {'table_name': 'bloodhound_testmodel',
+                     'object_name': 'TestModelObject',
+                     'key_fields': ['id',],
+                     'non_key_fields': ['value'],
+                     'unique_fields': [],}
+
+        from trac.db import DatabaseManager
+        schema = [TestModel._get_schema(), ]
+        with self.env.db_transaction as db:
+            db_connector, dummy = DatabaseManager(self.env)._get_connector()
+            for table in schema:
+                for statement in db_connector.to_sql(table):
+                    db(statement)
+        
+        structure =  dict([(table.name, [col.name for col in table.columns])
+                           for table in schema])
+        tm1 = TestModel(self.env)
+        tm1._data.update({'id':1,'value':'value1'})
+        tm1.insert()
+        tm2 = TestModel(self.env)
+        tm2._data.update({'id':2,'value':'value2'})
+        tm2.insert()
+
 if __name__ == '__main__':
     unittest.main()
 

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/htdocs/js/theme.js
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/htdocs/js/theme.js?rev=1447714&r1=1447713&r2=1447714&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/htdocs/js/theme.js (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/htdocs/js/theme.js Tue Feb 19 13:29:55 2013
@@ -75,6 +75,8 @@ $( function () {
     $('#qct-create').click(
         function() {
           var base_url = $('#qct-create').attr('data-target');
+          if (base_url === '/')
+            base_url = '';
           $.post(base_url + '/qct', $('#qct-form').serialize(), 
               function(ticket_id) {
                 qct_alert({

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_milestone_edit.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_milestone_edit.html?rev=1447714&r1=1447713&r2=1447714&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_milestone_edit.html (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_milestone_edit.html Tue Feb 19 13:29:55 2013
@@ -60,10 +60,12 @@
 
   <body>
     <div id="content" class="milestone row">
+      <span class="span12">
       <py:choose test="milestone.exists">
         <h1 py:when="True">Edit Milestone ${milestone.name}</h1>
         <h1 py:otherwise="">New Milestone</h1>
       </py:choose>
+      </span>
 
       <form id="edit" action="" method="post" class="form-horizontal">
         <input type="hidden" name="id" value="${milestone.name}" />

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_query.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_query.html?rev=1447714&r1=1447713&r2=1447714&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_query.html (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_query.html Tue Feb 19 13:29:55 2013
@@ -51,7 +51,7 @@
 
   <body>
     <div id="content" class="query row">
-      <h1>$title <small class="numrows">(${ngettext('%(num)s match', '%(num)s matches', query.num_items)})</small></h1>
+      <span class="span12"><h1>$title <small class="numrows">(${ngettext('%(num)s match', '%(num)s matches', query.num_items)})</small></h1></span>
 
       <div py:if="description" id="description" class="span12"
           xml:space="preserve">

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_report_view.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_report_view.html?rev=1447714&r1=1447713&r2=1447714&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_report_view.html (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_report_view.html Tue Feb 19 13:29:55 2013
@@ -36,9 +36,9 @@
 
   <body>
     <div id="content" class="report row">
-      <h1>$title
+      <span class='span12'><h1>$title
         <small py:if="numrows" class="numrows">(${ngettext('%(num)s match', '%(num)s matches', numrows)})</small>
-      </h1>
+      </h1></span>
 
       <div class="span9">
         <div py:if="description" id="description" xml:space="preserve">

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html?rev=1447714&r1=1447713&r2=1447714&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html Tue Feb 19 13:29:55 2013
@@ -90,7 +90,7 @@
         <a py:otherwise="" href="#info" title="See the preview">Preview</a>
         &darr;
       </div>
-      <h1 i18n:msg="name">Editing ${name_of(page.resource)}</h1>
+      <span class="span12"><h1 i18n:msg="name">Editing ${name_of(page.resource)}</h1></span>
       <div py:if="merge" class="system-message span12">
         <div class="alert">
           <p>