incubator-bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g..@apache.org
Subject svn commit: r1294755 - /incubator/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
Date Tue, 28 Feb 2012 18:16:29 GMT
Author: gjm
Date: Tue Feb 28 18:16:28 2012
New Revision: 1294755

URL: http://svn.apache.org/viewvc?rev=1294755&view=rev
Log:
modify the overridden TicketModule methods to cater for no product situations

Modified:
    incubator/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py

Modified: incubator/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py?rev=1294755&r1=1294754&r2=1294755&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py (original)
+++ incubator/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py Tue Feb
28 18:16:28 2012
@@ -40,7 +40,8 @@ class ProductTicketModule(TicketModule):
     # IRequestHandler methods
     def match_request(self, req):
         """Override of TicketModule match_request"""
-        match = PRODUCT_RE.match(req.path_info)
+        pathinfo = req.path_info[:]
+        match = PRODUCT_RE.match(pathinfo)
         if match:
             pid = match.group('pid')
             products = Product.select(self.env, where={'prefix':pid})
@@ -48,18 +49,20 @@ class ProductTicketModule(TicketModule):
                 req.args['productid'] = match.group('pid')
                 req.args['product'] = products[0].name
                 pathinfo = match.group('pathinfo')
-                # is it a newticket request:
-                if pathinfo == "/newticket":
-                    return True
-                tmatch = TICKET_RE.match(pathinfo)
-                if tmatch:
-                    req.args['id'] = tmatch.group('ticket')
-                    return True
+            
+        # is it a newticket request:
+        if pathinfo == "/newticket":
+            return True
+        tmatch = TICKET_RE.match(pathinfo)
+        if tmatch:
+            req.args['id'] = tmatch.group('ticket')
+            return True
     
     def process_request(self, req):
         """Override for TicketModule process_request"""
         if 'id' in req.args:
-            if req.path_info == '/' + req.args['product'] + '/newticket':
+            if (req.path_info == '/newticket' or
+               '/' + req.args['product'] + '/newticket'):
                 raise TracError(_("id can't be set for a new ticket request"))
             return self._process_ticket_request(req)
             #switch to the surrogate key



Mime
View raw message