You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by ah...@apache.org on 2013/09/16 22:19:00 UTC

svn commit: r1523790 [2/3] - in /bloodhound/branches/bep_0007_embeddable_objects: ./ bloodhound_dashboard/ bloodhound_dashboard/bhdashboard/ bloodhound_dashboard/bhdashboard/htdocs/css/ bloodhound_dashboard/bhdashboard/htdocs/js/ bloodhound_dashboard/b...

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/util.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/util.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/util.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/util.py Mon Sep 16 20:18:56 2013
@@ -1,146 +1,160 @@
-
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-
-"""Bloodhound multiproduct utility APIs"""
-
-from genshi.builder import tag
-
-from trac.util.text import unquote_label
-from trac.wiki.formatter import LinkFormatter
-from trac.core import Component, ComponentMeta
-
-#----------------------------
-# Component replacement base
-#----------------------------
-
-class ReplacementComponentMeta(ComponentMeta):
-    """Component replacement meta class"""
-    def __new__(mcs, name, bases, d):
-        if bases[0] != Component:
-            bases = bases[1:]
-            base_class = bases[0]
-
-            # undo what has been done by ComponentMeta.__new___ for the
-            # replacement component base class
-
-            # remove implemented interfaces from registry for the base class
-            for itf in base_class._implements:
-                ComponentMeta._registry[itf] = filter(lambda c: c != base_class,
-                                                      ComponentMeta._registry[itf])
-
-            # remove base class from components list
-            ComponentMeta._components = filter(lambda c: c != base_class,
-                                               ComponentMeta._components)
-
-            base_class._implements = []
-            base_class.abstract = True
-
-        return ComponentMeta.__new__(mcs, name, bases, d)
-
-class ReplacementComponent(Component):
-    """Base class for components that replace existing trac
-    implementations"""
-    __metaclass__ = ReplacementComponentMeta
-
-#--------------------------
-# Custom wiki formatters
-#--------------------------
-
-class EmbeddedLinkFormatter(LinkFormatter):
-    """Format the inner TracLinks expression corresponding to resources 
-    in compound links e.g. product:PREFIX:ticket:1 , global:ticket:1
-    """
-
-    def __init__(self, env, context, parent_match=None):
-        """Extend initializer signature to accept parent match
-        
-        @param parent_match: mapping object containing the following keys
-                        - ns : namespace of parent resolver
-                        - target : target supplied in to parent resolver
-                        - label: label supplied in to parent resolver
-                        - fullmatch : parent regex match (optional)
-        """
-        super(EmbeddedLinkFormatter, self).__init__(env, context)
-        self.parent_match = parent_match
-        self.auto_quote = False
-
-    def match(self, wikitext):
-        if self.auto_quote:
-            parts = tuple(wikitext.split(':', 1))
-            if len(parts) == 2:
-                if parts[1]:
-                    _wikitext = '%s:"%s"' % parts
-                else:
-                    _wikitext = '[%s:]' % parts[:1]
-            else:
-                _wikitext = wikitext
-        return super(EmbeddedLinkFormatter, self).match(_wikitext)
-
-    @staticmethod
-    def enhance_link(link):
-        return link
-
-    def handle_match(self, fullmatch):
-        if self.parent_match is None:
-            return super(EmbeddedLinkFormatter, self).handle_match(fullmatch)
-
-        for itype, match in fullmatch.groupdict().items():
-            if match and not itype in self.wikiparser.helper_patterns:
-                # Check for preceding escape character '!'
-                if match[0] == '!':
-                    # Erroneous expression. Nested link would be escaped 
-                    return tag.a(self.parent_match['label'], class_='missing')
-                if itype in self.wikiparser.external_handlers:
-                    #TODO: Important! Add product prefix in label (when needed?)
-                    external_handler = self.wikiparser.external_handlers[itype]
-                    link = external_handler(self, match, fullmatch)
-                else:
-                    internal_handler = getattr(self, '_%s_formatter' % itype)
-                    link = internal_handler(match, fullmatch)
-                return self.enhance_link(link)
-
-    # Overridden formatter methods
-    # TODO : Override more if necessary
-    def _shref_formatter(self, match, fullmatch):
-        if self.parent_match is None:
-            return super(EmbeddedLinkFormatter, self)._shref_formatter(
-                    match, fullmatch)
-        ns = fullmatch.group('sns')
-        target = unquote_label(fullmatch.group('stgt'))
-        label = (self.parent_match['label']
-                 if self.parent_match['label'] != self.parent_match['target']
-                 else target)
-        return self._make_link(ns, target, match, label, fullmatch)
-
-    def _lhref_formatter(self, match, fullmatch):
-        if self.parent_match is None:
-            return super(EmbeddedLinkFormatter, self)._lhref_formatter(
-                    match, fullmatch)
-        rel = fullmatch.group('rel')
-        ns = fullmatch.group('lns')
-        target = unquote_label(fullmatch.group('ltgt'))
-        label = (self.parent_match['label']
-                 if self.parent_match['label'] != self.parent_match['target']
-                 else fullmatch.group('label'))
-        return self._make_lhref_link(match, fullmatch, rel, ns, target, label)
-
-#----------------------
-# Useful regex
-#----------------------
-
-IDENTIFIER = r'(?!\d)\w+'
+
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+"""Bloodhound multiproduct utility APIs"""
+
+from genshi.builder import tag
+
+import trac.db.api
+from trac.util.text import unquote_label
+from trac.wiki.formatter import LinkFormatter
+from trac.core import Component, ComponentMeta
+
+#----------------------------
+# Component replacement base
+#----------------------------
+
+class ReplacementComponentMeta(ComponentMeta):
+    """Component replacement meta class"""
+    def __new__(mcs, name, bases, d):
+        if bases[0] != Component:
+            bases = bases[1:]
+            base_class = bases[0]
+
+            # undo what has been done by ComponentMeta.__new___ for the
+            # replacement component base class
+
+            # remove implemented interfaces from registry for the base class
+            for itf in base_class._implements:
+                ComponentMeta._registry[itf] = filter(lambda c: c != base_class,
+                                                      ComponentMeta._registry[itf])
+
+            # remove base class from components list
+            ComponentMeta._components = filter(lambda c: c != base_class,
+                                               ComponentMeta._components)
+
+            base_class._implements = []
+            base_class.abstract = True
+
+        return ComponentMeta.__new__(mcs, name, bases, d)
+
+class ReplacementComponent(Component):
+    """Base class for components that replace existing trac
+    implementations"""
+    __metaclass__ = ReplacementComponentMeta
+
+#--------------------------
+# Custom wiki formatters
+#--------------------------
+
+class EmbeddedLinkFormatter(LinkFormatter):
+    """Format the inner TracLinks expression corresponding to resources 
+    in compound links e.g. product:PREFIX:ticket:1 , global:ticket:1
+    """
+
+    def __init__(self, env, context, parent_match=None):
+        """Extend initializer signature to accept parent match
+        
+        @param parent_match: mapping object containing the following keys
+                        - ns : namespace of parent resolver
+                        - target : target supplied in to parent resolver
+                        - label: label supplied in to parent resolver
+                        - fullmatch : parent regex match (optional)
+        """
+        super(EmbeddedLinkFormatter, self).__init__(env, context)
+        self.parent_match = parent_match
+        self.auto_quote = False
+
+    def match(self, wikitext):
+        if self.auto_quote:
+            parts = tuple(wikitext.split(':', 1))
+            if len(parts) == 2:
+                if parts[1]:
+                    _wikitext = '%s:"%s"' % parts
+                else:
+                    _wikitext = '[%s:]' % parts[:1]
+            else:
+                _wikitext = wikitext
+        return super(EmbeddedLinkFormatter, self).match(_wikitext)
+
+    @staticmethod
+    def enhance_link(link):
+        return link
+
+    def handle_match(self, fullmatch):
+        if self.parent_match is None:
+            return super(EmbeddedLinkFormatter, self).handle_match(fullmatch)
+
+        for itype, match in fullmatch.groupdict().items():
+            if match and not itype in self.wikiparser.helper_patterns:
+                # Check for preceding escape character '!'
+                if match[0] == '!':
+                    # Erroneous expression. Nested link would be escaped 
+                    return tag.a(self.parent_match['label'], class_='missing')
+                if itype in self.wikiparser.external_handlers:
+                    #TODO: Important! Add product prefix in label (when needed?)
+                    external_handler = self.wikiparser.external_handlers[itype]
+                    link = external_handler(self, match, fullmatch)
+                else:
+                    internal_handler = getattr(self, '_%s_formatter' % itype)
+                    link = internal_handler(match, fullmatch)
+                return self.enhance_link(link)
+
+    # Overridden formatter methods
+    # TODO : Override more if necessary
+    def _shref_formatter(self, match, fullmatch):
+        if self.parent_match is None:
+            return super(EmbeddedLinkFormatter, self)._shref_formatter(
+                    match, fullmatch)
+        ns = fullmatch.group('sns')
+        target = unquote_label(fullmatch.group('stgt'))
+        label = (self.parent_match['label']
+                 if self.parent_match['label'] != self.parent_match['target']
+                 else target)
+        return self._make_link(ns, target, match, label, fullmatch)
+
+    def _lhref_formatter(self, match, fullmatch):
+        if self.parent_match is None:
+            return super(EmbeddedLinkFormatter, self)._lhref_formatter(
+                    match, fullmatch)
+        rel = fullmatch.group('rel')
+        ns = fullmatch.group('lns')
+        target = unquote_label(fullmatch.group('ltgt'))
+        label = (self.parent_match['label']
+                 if self.parent_match['label'] != self.parent_match['target']
+                 else fullmatch.group('label'))
+        return self._make_lhref_link(match, fullmatch, rel, ns, target, label)
+
+
+def get_db_connector_from_uri(env):
+    connector, arg = trac.db.api._parse_db_str(
+        trac.db.api.DatabaseManager(env).connection_uri
+    )
+    return connector
+    
+def using_sqlite_backend(env):
+    return get_db_connector_from_uri(env) == 'sqlite'
+
+def using_mysql_backend(env):
+    return get_db_connector_from_uri(env) == 'mysql'
+
+#----------------------
+# Useful regex
+#----------------------
+
+IDENTIFIER = r'(?!\d)\w+'

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/util.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/versioncontrol.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/web_ui.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/web_ui.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/multiproduct/web_ui.py Mon Sep 16 20:18:56 2013
@@ -21,24 +21,43 @@
 Provides request filtering to capture product related paths
 """
 
+import re
+
 from trac.core import Component, TracError, implements
 from trac.resource import Neighborhood, Resource, ResourceNotFound
 from trac.util.translation import _
-from trac.web.api import HTTPNotFound, IRequestHandler
+from trac.web.api import HTTPNotFound, IRequestHandler, IRequestFilter
 from trac.web.chrome import (
     Chrome, INavigationContributor, add_link, add_notice, add_warning,
     prevnext_nav, web_context
 )
 
+from multiproduct.env import resolve_product_href, lookup_product_env
 from multiproduct.hooks import PRODUCT_RE
 from multiproduct.model import Product
+from multiproduct.env import ProductEnvironment
+
 
+# requests to the following URLs will be skipped in the global scope
+# (no more redirection to default product)
+IGNORED_REQUESTS_RE = \
+    re.compile(r'^/(?P<section>milestone|roadmap|diff|search|'
+               r'(raw-|zip-)?attachment/(ticket|milestone))(?P<pathinfo>.*)')
 
 class ProductModule(Component):
     """Base Product behaviour"""
 
-    implements(IRequestHandler)
+    implements(IRequestFilter, IRequestHandler)
+
+    # IRequestFilter methods
+    def pre_process_request(self, req, handler):
+        if not isinstance(self.env, ProductEnvironment) and \
+           IGNORED_REQUESTS_RE.match(req.path_info):
+           return None
+        return handler
 
+    def post_process_request(req, template, data, content_type):
+        return template, data, content_type
 
     # IRequestHandler methods
     def match_request(self, req):
@@ -103,6 +122,8 @@ class ProductModule(Component):
         products = [p for p in Product.select(self.env)
                     if 'PRODUCT_VIEW' in req.perm(Neighborhood('product',
                                                                p.prefix))]
+        map(lambda p: setattr(p, 'href', resolve_product_href(
+            lookup_product_env(self.env, p.prefix), self.env)), products)
         data = {'products': products,
                 'context': web_context(req, Resource('product', None))}
         return 'product_list.html', data, None

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/setup.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/setup.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/setup.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/setup.py Mon Sep 16 20:18:56 2013
@@ -35,7 +35,7 @@ if __name__ == '__main__':
 
 setup(
     name = 'BloodhoundMultiProduct',
-    version = '0.7.0',
+    version = '0.8.0',
     description = "Multiproduct support for Apache(TM) Bloodhound.",
     author = "Apache Bloodhound",
     license = "Apache License v2",
@@ -46,6 +46,7 @@ setup(
             'multiproduct.model = multiproduct.model',
             'multiproduct.perm = multiproduct.perm',
             'multiproduct.product_admin = multiproduct.product_admin',
+            'multiproduct.ticket.batch = multiproduct.ticket.batch',
             'multiproduct.ticket.query = multiproduct.ticket.query',
             'multiproduct.ticket.web_ui = multiproduct.ticket.web_ui',
             'multiproduct.web_ui = multiproduct.web_ui',

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/admin/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/admin/console-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/admin/console.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/admin/product_admin.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/attachment.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/config.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/core.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/cursor.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/cursor.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/cursor.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/cursor.py Mon Sep 16 20:18:56 2013
@@ -992,7 +992,7 @@ data = {
     'insert_with_product': [
         (
 """INSERT INTO ticket (summary, product) VALUES ('S', 'swlcu')""",
-"""INSERT INTO ticket (summary, product) VALUES ('S', 'swlcu')"""
+"""INSERT INTO ticket (summary, product, id) VALUES ('S', 'swlcu',COALESCE((SELECT MAX(id) FROM\n(SELECT * FROM ticket WHERE product='PRODUCT')\nAS subquery), 0)+1)"""
         ),
     ],
 

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/cursor.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/mysql.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/postgres.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/db/util.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/env.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/hooks.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/mimeview/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/mimeview/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/mimeview/patch.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/mimeview/pygments.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/perm.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-attachment-link-tests.short.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-attachment-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-comment-link-tests.short.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-comment-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-milestone-link-tests.short.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-milestone-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-nomatch-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.short.txt
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.short.txt?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.short.txt (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.short.txt Mon Sep 16 20:18:56 2013
@@ -43,7 +43,7 @@
 <a class="query" href="%(path_prefix)s/query?group=owner&amp;order=priority">%(link_prefix_escaped)squery:group=owner</a>
 </p>
 <p>
-<a class="query" href="%(path_prefix)s/query?order=priority&amp;row=description">%(link_prefix_escaped)squery:verbose=1</a>
+<a class="query" href="%(path_prefix)s/query?row=description&amp;order=priority">%(link_prefix_escaped)squery:verbose=1</a>
 </p>
 <p>
 <a class="query" href="%(path_prefix)s/query?summary=r%%C3%%A9sum%%C3%%A9&amp;order=priority">%(link_prefix_escaped)squery:summary=résumé</a>

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.short.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.txt
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.txt?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.txt (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.txt Mon Sep 16 20:18:56 2013
@@ -43,7 +43,7 @@
 <a class="query" href="%(path_prefix)s/query?group=owner&amp;order=priority">%(link_prefix_escaped)squery:group=owner</a>
 </p>
 <p>
-<a class="query" href="%(path_prefix)s/query?order=priority&amp;row=description">%(link_prefix_escaped)squery:verbose=1</a>
+<a class="query" href="%(path_prefix)s/query?row=description&amp;order=priority">%(link_prefix_escaped)squery:verbose=1</a>
 </p>
 <p>
 <a class="query" href="%(path_prefix)s/query?summary=r%%C3%%A9sum%%C3%%A9&amp;order=priority">%(link_prefix_escaped)squery:summary=résumé</a>

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-query2-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-report-link-tests.short.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-report-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-search-link-tests.short.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-search-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-ticket-jira-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-ticket-link-tests.short.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/product-ticket-link-tests.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/resource.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/batch.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/conversion.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py Mon Sep 16 20:18:56 2013
@@ -22,12 +22,13 @@ from datetime import datetime
 import shutil
 import unittest
 
-from trac.ticket.model import Milestone
+from trac.ticket.model import Milestone, Ticket
 from trac.ticket.tests.model import TicketTestCase, TicketCommentTestCase, \
         TicketCommentEditTestCase, TicketCommentDeleteTestCase, EnumTestCase, \
         MilestoneTestCase, ComponentTestCase, VersionTestCase
 from trac.util.datefmt import to_utimestamp, utc
 
+from multiproduct.model import Product
 from multiproduct.env import ProductEnvironment
 from tests.env import MultiproductTestCase
 
@@ -47,6 +48,46 @@ class ProductTicketTestCase(TicketTestCa
         self.global_env.reset_db()
         self.env = self.global_env = None
 
+    def _get_ticket_uid(self, tid):
+        with self.env.db_query as db:
+            rows = db("""SELECT uid FROM ticket WHERE id=%s""", (tid, ))
+            return rows[0][0] if rows else -1
+
+    def test_insert_into_multiple_products(self):
+        # UIDs are global, autoincremented
+        # IDs are product-scoped, incremented in the SQL translator
+        self.env = ProductEnvironment(self.global_env, self.default_product)
+
+        tid = self._insert_ticket('hello kitty', reporter='admin')
+        ticket = Ticket(self.env, tid)
+        self.assertEqual(tid, 1)
+        self.assertEqual(self._get_ticket_uid(tid), 1)
+        self.assertEqual(ticket.id, tid)
+        tid = self._insert_ticket('hello kitteh', reporter='admin')
+        ticket = Ticket(self.env, tid)
+        self.assertEqual(tid, 2)
+        self.assertEqual(self._get_ticket_uid(tid), 2)
+        self.assertEqual(ticket.id, tid)
+
+        p2 = Product(self.global_env)
+        p2.prefix = 'p2'
+        p2.name = 'product, too'
+        p2.owner = 'admin'
+        p2.insert()
+        self.env = ProductEnvironment(self.global_env, p2)
+
+        tid = self._insert_ticket('hello catty', reporter='admin')
+        ticket = Ticket(self.env, tid)
+        self.assertEqual(tid, 1)
+        self.assertEqual(self._get_ticket_uid(tid), 3)
+        self.assertEqual(ticket.id, tid)
+        tid = self._insert_ticket('hello ocelot', reporter='admin')
+        ticket = Ticket(self.env, tid)
+        self.assertEqual(tid, 2)
+        self.assertEqual(self._get_ticket_uid(tid), 4)
+        self.assertEqual(ticket.id, tid)
+
+
 class ProductTicketCommentTestCase(MultiproductTestCase):
 
     @property

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/model.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/notification.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/query.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/report.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/roadmap.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/ticket/wikisyntax.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py Mon Sep 16 20:18:56 2013
@@ -351,6 +351,66 @@ class EnvironmentUpgradeTestCase(unittes
         self.assertEqual(len(products), 1)
         self.assertEqual(products[0].prefix, 'xxx')
 
+    def test_migration_to_multiproduct_preserves_ticket_ids(self):
+        for ticket_id in (1, 3, 5, 7):
+            with self.env.db_transaction as db:
+                cursor = db.cursor()
+                cursor.execute("INSERT INTO ticket (id) VALUES (%i)" % ticket_id)
+                db.update_sequence(cursor, 'ticket')
+
+        self._enable_multiproduct()
+        self.env.upgrade()
+
+        for ticket_id in (1, 3, 5, 7):
+            with self.product('@'):
+                ticket = Ticket(self.env, ticket_id)
+            self.assertEqual(ticket.id, ticket_id)
+
+    def test_can_insert_tickets_after_upgrade(self):
+        t1 = Ticket(self.env)
+        t1.summary = "test"
+        t1.insert()
+        self.assertEqual(t1.id, 1)
+
+        self._enable_multiproduct()
+        self.env.upgrade()
+
+        with self.product('@'):
+            ticket = Ticket(self.env)
+            ticket.summary = 'test'
+            ticket.insert()
+            self.assertEqual(ticket.id, 2)
+
+    def test_can_insert_tickets_with_same_id_to_different_products(self):
+        self._enable_multiproduct()
+        self.env.upgrade()
+
+        self.env.db_transaction("INSERT INTO ticket (id, summary)"
+                                "            VALUES (1, 'first product')")
+        t1 = Ticket(self.env, 1)
+
+        with self.product('@'):
+            self.env.db_transaction("INSERT INTO ticket (id, summary)"
+                                    "            VALUES (1, 'second product')")
+            t2 = Ticket(self.env, 1)
+
+        self.assertEqual(t1.id, t2.id)
+        self.assertNotEqual(t1['summary'], t2['summary'])
+
+    def test_batch_ticket_insert_after_upgrade(self):
+        self._enable_multiproduct()
+        self.env.upgrade()
+        with self.env.db_direct_transaction as db:
+            db("""CREATE TABLE "@_tmp" (summary text, product text)""")
+            for summary in "abcdef":
+                db("""INSERT INTO "@_tmp" VALUES ('%s', '@')""" % (summary,))
+
+        with self.product('@'):
+            with self.env.db_transaction as db:
+                db("""INSERT INTO ticket (summary) SELECT summary FROM tmp""")
+
+
+
     def _enable_multiproduct(self):
         self._update_config('components', 'multiproduct.*', 'enabled')
 

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/upgrade_postgres.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/cache.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/versioncontrol/svn_authz.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/chrome.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/session.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web/wikisyntax.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/web_ui.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/formatter.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/macros.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/model.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wiki/wikisyntax.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_multiproduct/tests/wikisyntax.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py Mon Sep 16 20:18:56 2013
@@ -41,6 +41,26 @@ from trac.util.datefmt import utc, to_ut
 from trac.web.chrome import ITemplateProvider
 
 PLUGIN_NAME = 'Bloodhound Relations Plugin'
+RELATIONS_CONFIG_NAME = 'bhrelations_links'
+
+default_bhrelations_links = {
+    'children.label': 'is a child of',
+    'dependency': 'dependson,dependent',
+    'dependency.validators': 'NoCycles,SingleProduct',
+    'dependson.blocks': 'true',
+    'dependson.label': 'depends on',
+    'dependent.label': 'is a dependency of',
+    'oneway': 'refersto',
+    'parent_children': 'parent,children',
+    'parent.exclusive': 'true',
+    'parent.label': 'is a parent of',
+    'parent_children.validators': 'OneToMany,SingleProduct,NoCycles',
+    'refersto.label': 'refers to',
+    'duplicate': 'duplicateof,duplicatedby',
+    'duplicate.validators': 'ReferencesOlder',
+    'duplicateof.label': 'is a duplicate of',
+    'duplicatedby.label': 'is duplicated by',
+}
 
 
 #TODO: consider making the interface part of future
@@ -106,7 +126,8 @@ class EnvironmentSetup(Component):
             this version of the %s (%d).''' % (db_installed_version,
                                                PLUGIN_NAME,
                                                db_version))
-        needs_upgrade = db_installed_version < db_version
+        needs_upgrade = db_installed_version < db_version or \
+                        not list(self.config.options(RELATIONS_CONFIG_NAME))
         return needs_upgrade
 
     def upgrade_environment(self, db):
@@ -118,6 +139,13 @@ class EnvironmentSetup(Component):
             self._update_db_version(db, db_default.DB_VERSION)
             #add upgrade logic later if needed
 
+        if not list(self.config.options(RELATIONS_CONFIG_NAME)):
+            for option, value in default_bhrelations_links.iteritems():
+                self.config.set(RELATIONS_CONFIG_NAME, option, value)
+            self.config.save()
+            print("Your environment has been upgraded with the default "
+                  "[bhrelations_links] configuration.")
+
     def _get_version(self, db):
         """Finds the current version of the bloodhound database schema"""
         rows = db("""
@@ -162,13 +190,13 @@ class EnvironmentSetup(Component):
 class RelationsSystem(Component):
     PARENT_RELATION_TYPE = 'parent'
     CHILDREN_RELATION_TYPE = 'children'
-    RELATIONS_CONFIG_NAME = 'bhrelations_links'
 
     changing_listeners = ExtensionPoint(IRelationChangingListener)
     all_validators = ExtensionPoint(IRelationValidator)
     global_validators = OrderedExtensionsOption(
         'bhrelations', 'global_validators',
-        interface=IRelationValidator,
+        IRelationValidator,
+        'NoSelfReferenceValidator, ExclusiveValidator, BlockerValidator',
         include_missing=False,
         doc="""Validators used to validate all relations,
         regardless of their type."""
@@ -177,7 +205,7 @@ class RelationsSystem(Component):
     duplicate_relation_type = Option(
         'bhrelations',
         'duplicate_relation',
-        '',
+        'duplicateof',
         "Relation type to be used with the resolve as duplicate workflow.")
 
     def __init__(self):
@@ -241,9 +269,6 @@ class RelationsSystem(Component):
             for listener in self.changing_listeners:
                 listener.adding_relation(relation)
 
-            from bhrelations.notification import RelationNotifyEmail
-            RelationNotifyEmail(self.env).notify(relation)
-
     def delete(self, relation_id, when=None):
         if when is None:
             when = datetime.now(utc)
@@ -328,7 +353,7 @@ class RelationsSystem(Component):
         copy_fields = {}
         exclusive = set()
 
-        config = self.config[self.RELATIONS_CONFIG_NAME]
+        config = self.config[RELATIONS_CONFIG_NAME]
         for name in [option for option, _ in config.options()
                      if '.' not in option]:
             reltypes = config.getlist(name)

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/db_default.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/model.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/notification.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/templates/relation_notify_email.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/base.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/base.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/base.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/base.py Mon Sep 16 20:18:56 2013
@@ -18,7 +18,8 @@
 from _sqlite3 import OperationalError
 from tests.env import MultiproductTestCase
 from multiproduct.env import ProductEnvironment
-from bhrelations.api import RelationsSystem, EnvironmentSetup
+from bhrelations.api import RelationsSystem, EnvironmentSetup, \
+    RELATIONS_CONFIG_NAME
 from trac.test import EnvironmentStub, Mock, MockPerm
 from trac.ticket import Ticket
 from trac.util.datefmt import utc
@@ -43,7 +44,7 @@ class BaseRelationsTestCase(Multiproduct
                        'BlockerValidator')
         env.config.set('bhrelations', 'duplicate_relation',
                        'duplicateof')
-        config_name = RelationsSystem.RELATIONS_CONFIG_NAME
+        config_name = RELATIONS_CONFIG_NAME
         env.config.set(config_name, 'dependency', 'dependson,dependent')
         env.config.set(config_name, 'dependency.validators',
                        'NoCycles,SingleProduct')
@@ -72,7 +73,8 @@ class BaseRelationsTestCase(Multiproduct
 
         self.req = Mock(href=self.env.href, authname='anonymous', tz=utc,
                         args=dict(action='dummy'),
-                        locale=locale_en, lc_time=locale_en)
+                        locale=locale_en, lc_time=locale_en,
+                        chrome={'warnings': []})
         self.req.perm = MockPerm()
         self.relations_system = RelationsSystem(self.env)
         self._upgrade_env()

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/base.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/mocks.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/notification.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/notification.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/notification.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/notification.py Mon Sep 16 20:18:56 2013
@@ -69,8 +69,7 @@ class NotificationTestCase(BaseRelations
         relation = self.relations_system.add(
             ticket, ticket2, "dependent")
 
-        rn = RelationNotifyEmail(self.env)
-        rn.notify(relation)
+        self.notifier.notify(relation)
 
         recipients = self.smtpd.get_recipients()
         # checks there is no duplicate in the recipient list
@@ -95,7 +94,8 @@ class NotificationTestCase(BaseRelations
         ticket = self._insert_and_load_ticket('Foo', reporter='anonymous')
         ticket2 = self._insert_and_load_ticket('Bar', reporter='anonymous')
 
-        self.relations_system.add(ticket, ticket2, "dependent")
+        relation = self.relations_system.add(ticket, ticket2, "dependent")
+        self.notifier.notify(relation)
 
         sender = self.smtpd.get_sender()
         recipients = self.smtpd.get_recipients()
@@ -110,6 +110,7 @@ class NotificationTestCase(BaseRelations
         ticket2 = self._insert_and_load_ticket('Bar', reporter='anonymous')
 
         relation = self.relations_system.add(ticket, ticket2, "dependent")
+        self.notifier.notify(relation)
 
         relations = self.env.db_direct_query(
             "SELECT * FROM bloodhound_relations")

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/notification.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/validation.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/web_ui.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/web_ui.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/web_ui.py Mon Sep 16 20:18:56 2013
@@ -86,6 +86,20 @@ class RelationManagementModuleTestCase(B
 
         self.assertEqual(len(data["relations"]), 1)
 
+    def test_failure_to_notify_does_not_result_in_error(self):
+        t2 = self._insert_ticket(self.env, "Bar")
+        self.req.args['add'] = True
+        self.req.args['dest_tid'] = str(t2)
+        self.req.args['reltype'] = 'dependson'
+        rlm = RelationManagementModule(self.env)
+        rlm.notify_relation_changed = self._failing_notification
+
+        url, data, x = rlm.process_request(self.req)
+        self.assertEqual(len(self.req.chrome['warnings']), 1)
+
+    def _failing_notification(self, relation):
+        raise Exception()
+
     def process_request(self):
         url, data, x = RelationManagementModule(self.env).process_request(
             self.req)

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/tests/web_ui.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/utils.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/validation.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/web_ui.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/web_ui.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/web_ui.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/web_ui.py Mon Sep 16 20:18:56 2013
@@ -29,6 +29,7 @@ import re
 from trac.core import Component, implements, TracError
 from trac.resource import get_resource_url, Resource
 from trac.ticket.model import Ticket
+from trac.util import exception_to_unicode, to_unicode
 from trac.util.translation import _
 from trac.web import IRequestHandler, IRequestFilter
 from trac.web.chrome import ITemplateProvider, add_warning
@@ -93,7 +94,7 @@ class RelationManagementModule(Component
                     req.perm.require('TICKET_MODIFY', Resource(dest_ticket.id))
 
                     try:
-                        relsys.add(ticket, dest_ticket,
+                        dbrel = relsys.add(ticket, dest_ticket,
                             relation['type'],
                             relation['comment'],
                             req.authname)
@@ -104,6 +105,18 @@ class RelationManagementModule(Component
                     except ValidationError as ex:
                         data['error'] = ex.message
 
+                # Notify
+                try:
+                    self.notify_relation_changed(dbrel)
+                except Exception, e:
+                    self.log.error("Failure sending notification on"
+                                   "creation of relation: %s",
+                                   exception_to_unicode(e))
+                    add_warning(req, _("The relation has been added, but an "
+                                       "error occurred while sending"
+                                       "notifications: " "%(message)s",
+                                       message=to_unicode(e)))
+
                 if 'error' in data:
                     data['relation'] = relation
             else:
@@ -115,7 +128,11 @@ class RelationManagementModule(Component
                 key=lambda x: x[0]),
             'relations': self.get_ticket_relations(ticket),
         })
-        return 'manage.html', data, None
+        return 'relations_manage.html', data, None
+
+    def notify_relation_changed(self, relation):
+        from bhrelations.notification import RelationNotifyEmail
+        RelationNotifyEmail(self.env).notify(relation)
 
     # ITemplateProvider methods
     def get_htdocs_dirs(self):

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/web_ui.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/widgets/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/bhrelations/widgets/relations.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/setup.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/setup.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/setup.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/setup.py Mon Sep 16 20:18:56 2013
@@ -34,6 +34,7 @@ versions = [
     (0, 5, 0),
     (0, 6, 0),
     (0, 7, 0),
+    (0, 8, 0),
     ]
 
 latest = '.'.join(str(x) for x in versions[-1])

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_relations/setup.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/admin.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/query_parser.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/query_suggestion.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/search_resources/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/search_resources/base.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/search_resources/changeset_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/search_resources/milestone_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/search_resources/ticket_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/search_resources/wiki_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/security.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/templates/bhsearch.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/templates/bhsearch_breadcrumbs.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/templates/opensearch.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/api.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/base.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/index_with_whoosh.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/query_parser.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/query_suggestion.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/real_index_view.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/search_resources/__init__.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/search_resources/base.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/search_resources/changeset_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/search_resources/milestone_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/search_resources/ticket_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/search_resources/wiki_search.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/security.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/web_ui.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/tests/whoosh_backend.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/utils.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/web_ui.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/whoosh_backend.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/bhsearch/whoosh_fixes.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/setup.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/setup.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/setup.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/setup.py Mon Sep 16 20:18:56 2013
@@ -35,6 +35,7 @@ versions = [
     (0, 5, 0),
     (0, 6, 0),
     (0, 7, 0),
+    (0, 8, 0),
     ]
 
 latest = '.'.join(str(x) for x in versions[-1])

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_search/setup.py
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/htdocs/bloodhound.css
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/htdocs/bloodhound.css?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/htdocs/bloodhound.css (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/htdocs/bloodhound.css Mon Sep 16 20:18:56 2013
@@ -374,6 +374,10 @@ h1, h2, h3, h4 {
  page-break-after: avoid;
 }
 
+h1, h2, h3 {
+ min-height: 40px;
+}
+
 .clip, .affix .clip-affix {
  overflow: hidden;
  text-overflow: ellipsis;
@@ -847,9 +851,11 @@ tt {
  border: 1px solid #DDDDDD;
  border-radius: 3px 3px 3px 3px;
  box-shadow: 0 1px 0 #FFFFFF inset;
+ display: none; /* can be removed after upgrading to jQuery UI 1.9 (http://bugs.jqueryui.com/ticket/4111 */
  list-style: none outside none;
  margin: 0 0 18px;
  padding: 7px 14px;
+ z-index: 1001 !important;
 }
 
 .ui-datepicker a.ui-datepicker-prev,

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_account_details.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_admin.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_admin_accountsconfig.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_admin_accountsnotification.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_admin_basics.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_admin_logging.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_admin_products.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_admin_users.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_browser.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_dir_entries.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_dirlist_thead.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_list_of_attachments.html
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_list_of_attachments.html?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_list_of_attachments.html (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_list_of_attachments.html Mon Sep 16 20:18:56 2013
@@ -45,7 +45,7 @@ Arguments:
   <py:if test="alist.attachments or alist.can_create">
     <div id="attachments" py:choose="">
       <py:when test="compact and alist.attachments">
-        <h3 class="${'foldable' if foldable else None}">Attachments</h3>
+        <h3 class="${'foldable' if foldable else None}">Attachments (${len(alist.attachments)})</h3>
         <div>
           <ul>
             <py:for each="attachment in alist.attachments">
@@ -62,7 +62,7 @@ Arguments:
         </div>
       </py:when>
       <py:when test="not compact">
-        <h3 id="comment:attachments">Attachments</h3>
+        <h3 id="comment:attachments">Attachments (${len(alist.attachments) if alist.attachments else 0})</h3>
         <div py:if="alist.attachments or alist.can_create" class="attachments">
           <dl py:if="alist.attachments" class="attachments">
             <py:for each="attachment in alist.attachments">

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_login.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_path_general.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_path_links.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_prefs_account.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_register.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_report_delete.html
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_report_delete.html?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_report_delete.html (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_report_delete.html Mon Sep 16 20:18:56 2013
@@ -31,7 +31,7 @@
 
   <body>
     <div id="content" class="report row">
-      <h1 class="span12">$report.title</h1>
+      <h1 class="span12">{$report.id} $report.title</h1>
       <div class="span12">
         <form action="${href.report()}" method="post">
           <p><strong>Are you sure you want to delete this report?</strong></p>

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_repository_index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_reset_password.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_revisionlog.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_sortable_th.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_user_table.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bh_verify_email.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bloodhound_theme.html
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bloodhound_theme.html?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bloodhound_theme.html (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/templates/bloodhound_theme.html Mon Sep 16 20:18:56 2013
@@ -60,8 +60,7 @@
             </a>
           </div>
           <!--! top menu (login, logout...) -->
-          <py:with vars="meta_items = dict([i.name, i] for i in chrome.nav.metanav);
-                         main_items = dict([i.name, i] for i in chrome.nav.mainnav);">
+          <py:with vars="meta_items = dict([i.name, i] for i in chrome.nav.metanav);">
             <div id="usermenu" class="span8">
               <div class="metanav pull-right">
                 <span id="nav_login" py:choose="">
@@ -77,8 +76,8 @@
                 <span py:if="'logout' in meta_items" id="nav_logout">
                   ${meta_items.logout.label}
                 </span>
-                <span py:if="'admin' in main_items">
-                  ${main_items.admin.label}
+                <span py:if="'admin' in meta_items">
+                  ${meta_items.admin.label}
                 </span>
                 <span py:if="'help' in meta_items">
                   ${meta_items.help.label}
@@ -118,10 +117,11 @@
                 <select id="field-${field.name}" name="field_${field.name}"
                     class="input-block-level" data-empty="true" data-field="${field.name}">
                   <option py:if="field.optional"></option>
-                  <option py:for="option in field.options"
+                  <option py:for="idx,option in enumerate(field.options)"
+                          py:with="description = field.options_desc[idx] if field.options_desc else option"
                           selected="${field.value == option or None}"
                           value = "$option"
-                          py:content="option"></option>
+                          py:content="description"></option>
                   <optgroup py:for="optgroup in field.optgroups"
                             py:if="optgroup.options"
                             label="${optgroup.label}">
@@ -215,23 +215,21 @@
           <!--! main navigation tabs -->
           <div class="span6">
             <ul py:if="chrome.nav.mainnav or chrome.nav.metanav"
-                class="nav nav-tabs pull-right"
-                id="mainnav"
+                class="nav nav-tabs pull-right" id="mainnav"
                 py:with="mainnav_show = ('wiki', 'tickets', 'browser');
-                          mainnav_to_meta = ('admin',);
-                          metanav_hide = ('login', 'logout', 'prefs', 'help', 'about', 'register')">
+                         metanav_hide = ('login', 'logout', 'prefs', 'help', 'about', 'register', 'admin')">
               <!--! TODO: Parameterize visible mainnav items in trac.ini -->
               <li py:if="chrome.nav.mainnav"
                   py:for="idx, item in enumerate(i for i in chrome.nav.mainnav if i.name in mainnav_show)" 
                   class="${classes(first_last(idx, chrome.nav.mainnav), active=item.active)}">${item.label}</li>
               <li class="dropdown ${all(not i.active for i in chrome.nav.mainnav if i.name in mainnav_show) and 'active' or None}"
                   py:if="len([i for i in chrome.nav.metanav if i.name not in metanav_hide] +
-                             [i for i in chrome.nav.mainnav if i.name not in mainnav_show + mainnav_to_meta])">
+                             [i for i in chrome.nav.mainnav if i.name not in mainnav_show])">
                 <a class="dropdown-toggle" data-toggle="dropdown" href="#">More<b class="caret"></b></a>
                 <ul class="dropdown-menu">
                   <li py:if="chrome.nav.mainnav"
                       py:for="idx, item in enumerate(i for i in chrome.nav.mainnav
-                                                     if i.name not in mainnav_show + mainnav_to_meta)"
+                                                     if i.name not in mainnav_show)"
                       class="${classes(first_last(idx, chrome.nav.mainnav), active=item.active)}">${item.label}</li>
                   <py:if test="chrome.nav.metanav">
                     <li py:if="len([i for i in chrome.nav.metanav if i.name not in metanav_hide])"

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/theme.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/bhtheme/theme.py Mon Sep 16 20:18:56 2013
@@ -35,7 +35,7 @@ from trac.util.presentation import to_js
 from trac.util.translation import _
 from trac.versioncontrol.web_ui.browser import BrowserModule
 from trac.web.api import IRequestFilter, IRequestHandler, ITemplateStreamFilter
-from trac.web.chrome import (add_stylesheet, INavigationContributor,
+from trac.web.chrome import (add_stylesheet, add_warning, INavigationContributor,
                              ITemplateProvider, prevnext_nav, Chrome)
 from trac.wiki.admin import WikiAdmin
 
@@ -249,7 +249,13 @@ class BloodhoundTheme(ThemeBase):
             return req.href.__call__("wiki", *a, **kw)
 
         req.href.wiki = hwiki
-        
+
+        # Move 'admin' entry from mainnav to metanav
+        for i, entry in enumerate(req.chrome['nav']['mainnav']):
+            if entry['name'] == 'admin':
+                req.chrome['nav']['metanav'] \
+                    .append(req.chrome['nav']['mainnav'].pop(i))
+
         return handler
 
     def post_process_request(self, req, template, data, content_type):
@@ -363,14 +369,15 @@ class BloodhoundTheme(ThemeBase):
                                          is_active)
 
         #add a creation event to the changelog if the ticket exists
-        if data['ticket'].exists:
+        ticket = data['ticket']
+        if ticket.exists:
             data['changes'] = [{'comment': '',
-                                'author': data['author_id'],
+                                'author': ticket['reporter'],
                                 'fields': {u'reported': {'label': u'Reported'},
                                            },
                                 'permanent': 1,
                                 'cnum': 0,
-                                'date': data['start_time'],
+                                'date': ticket['time'],
                                 },
                                ] + data['changes']
         #and set default order
@@ -480,21 +487,25 @@ class QuickCreateTicketDialog(Component)
                               for f in tm._prepare_fields(req, ticket)
                               if f['type'] == 'select')
 
-            product_field = all_fields['product']
+            product_field = all_fields.get('product')
             if product_field:
                 if self.env.product:
                     product_field['value'] = self.env.product.prefix
                 else:
-                    # Global scope, now check default_product_prefix is valid
-                    default_prefix = self.config.get('multiproduct',
-                                                     'default_product_prefix')
-                    try:
-                        ProductEnvironment.lookup_env(self.env, default_prefix)
-                    except LookupError:
-                        product_field['value'] = product_field['options'][0]
-                    else:
-                        product_field['value'] = default_prefix
-
+                    product_field['value'] = product_field['options'][0]
+                product_field['options_desc'] = [
+                    ProductEnvironment.lookup_env(self.env, p).product.name
+                        for p in product_field['options']
+                ]
+            else:
+                msg = _("Missing ticket field '%(field)s'.", field='product')
+                if ProductTicketModule is not None and \
+                        self.env[ProductTicketModule] is not None:
+                    # Display warning alert to users
+                    add_warning(req, msg)
+                else:
+                    # Include message in logs since this might be a failure
+                    self.log.warning(msg)
             data['qct'] = {
                 'fields': [all_fields[k] for k in self.qct_fields
                            if k in all_fields],
@@ -551,7 +562,14 @@ class QuickCreateTicketDialog(Component)
 
         PS: Borrowed from XmlRpcPlugin.
         """
-        t = Ticket(self.env)
+        if 'product' in attributes:
+            env = self.env.parent or self.env
+            if attributes['product']:
+                env = ProductEnvironment(env, attributes['product'])
+        else:
+            env = self.env
+
+        t = Ticket(env)
         t['summary'] = summary
         t['description'] = description
         t['reporter'] = req.authname
@@ -563,7 +581,7 @@ class QuickCreateTicketDialog(Component)
 
         if notify:
             try:
-                tn = TicketNotifyEmail(self.env)
+                tn = TicketNotifyEmail(env)
                 tn.notify(t, newticket=True)
             except Exception, e:
                 self.log.exception("Failure sending notification on creation "

Modified: bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/setup.py
URL: http://svn.apache.org/viewvc/bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/setup.py?rev=1523790&r1=1523789&r2=1523790&view=diff
==============================================================================
--- bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/setup.py (original)
+++ bloodhound/branches/bep_0007_embeddable_objects/bloodhound_theme/setup.py Mon Sep 16 20:18:56 2013
@@ -23,7 +23,7 @@ import sys
 
 setup(
   name = 'BloodhoundTheme',
-  version = '0.7.0',
+  version = '0.8.0',
   description = "Theme for Apache(TM) Bloodhound.",
   author = "Apache Bloodhound",
   license = "Apache License v2",

Propchange: bloodhound/branches/bep_0007_embeddable_objects/doc/html-templates/milestone.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/doc/html-templates/product.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bloodhound/branches/bep_0007_embeddable_objects/doc/html-templates/version.html
------------------------------------------------------------------------------
    svn:eol-style = native