Commits

Anonymous committed 4f67dca

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.

Comments (0)

Files changed (1)

bloodhound_theme/bhtheme/theme.py

 
         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
 
         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 "