Author: astaric
Date: Fri Sep 27 07:36:28 2013
New Revision: 1526812

URL: http://svn.apache.org/r1526812
Log:
Fetch product tickets using product environment.

Product.get_tickets uses direct query that sees tickets from all products,
but Ticket(id) does not, so it needs to be instantiated with the right env.

Modified:
    bloodhound/trunk/bloodhound_multiproduct/multiproduct/model.py

Modified: bloodhound/trunk/bloodhound_multiproduct/multiproduct/model.py
URL: 
http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_multiproduct/multiproduct/model.py?rev=1526812&r1=1526811&r2=1526812&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_multiproduct/multiproduct/model.py (original)
+++ bloodhound/trunk/bloodhound_multiproduct/multiproduct/model.py Fri Sep 27 
07:36:28 2013
@@ -74,8 +74,12 @@ class Product(ModelBase):
         now = datetime.now(utc)
         comment = 'Product %s renamed to %s' % (old_name, new_name)
         if old_name != new_name:
+            env = self._env.parent or self._env
+            if self._data['prefix']:
+                from multiproduct.env import ProductEnvironment
+                env = ProductEnvironment(env, self._data['prefix'])
             for t in Product.get_tickets(self._env, self._data['prefix']):
-                ticket = Ticket(self._env, t['id'], db)
+                ticket = Ticket(env, t['id'], db)
                 ticket.save_changes(author, comment, now)
 
     @classmethod


Reply via email to