Author: astaric
Date: Tue Aug 27 10:00:31 2013
New Revision: 1517775

URL: http://svn.apache.org/r1517775
Log:
QCT: Create ticket in product env.

If ticket is created in different env with product
field specified, plugins listening to events will
be called with the wrong env.

Modified:
    bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Modified: bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1517775&r1=1517774&r2=1517775&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Tue Aug 27 10:00:31 2013
@@ -564,7 +564,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
@@ -576,7 +583,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 "


Reply via email to