incubator-bloodhound-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary <gary.mar...@wandisco.com>
Subject Re: [RFC] [multiproduct] Review #1
Date Sun, 17 Jun 2012 19:39:34 GMT
On 15/06/12 23:16, Olemis Lang wrote:
>
>> Meanwhile I didn't follow the p prefix idea but instead decided on
>> req.path_info.startswith('/products') so that it is more obvious what it
>> is for. I don't mind variations on that but I think that /p is not
>> enough to retain clarity. Even if google use it.
>>
> yes , that's ok . any prefix is ok . Nonetheless I see this code for
> `ProductTicketModule.match_request` ...
>
> {{{
> #!python
>
> PRODUCT_RE = re.compile(r'^/(?P<pid>[^/]*)(?P<pathinfo>.*)')
> TICKET_RE = re.compile(r'/ticket/(?P<ticket>[0-9]+)$')
> class ProductTicketModule(TicketModule):
>      """Product Overrides for the TicketModule"""
>
>      # IRequestHandler methods
>      def match_request(self, req):
>          """Override of TicketModule match_request"""
>          match = PRODUCT_RE.match(req.path_info)
>          if match:
>              pid = match.group('pid')
>              products = Product.select(self.env, where={'prefix':pid})
>              if len(products) == 1:
>                  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
>
> }}}
>
> ... and as a consequence it seems ticket URLs will look like
> http://server.com/path/to/bh/MyProduct/ticket/33 ... i.e. no prefix at
> all .

That would be the case given the PRODUCE_RE regex shown. However, that 
is not the current code. Contrast with 
http://svn.apache.org/repos/asf/incubator/bloodhound/trunk/bloodhound_multiproduct/multiproduct/ticket/web_ui.py

Cheers,
     Gary

Mime
View raw message