
mark.cooke at siemens
Aug 8, 2012, 2:21 AM
Post #4 of 7
(194 views)
Permalink
|
> -----Original Message----- > From: trac-users [at] googlegroups On Behalf Of Remy Blank > Sent: 08 August 2012 10:01 > To: trac-users [at] googlegroups > Subject: Re: [Trac] Problem with `search` > > > Trac 0.12.3 (and current trunk at t.e.o) search uses the following: > > {{{ > > def match_request(self, req): > > return re.match(r'/search(?:/opensearch)?$', > req.path_info) is not None > > }}} > > > > ...which matches search at the end of any URL. > > No, re.match() matches at the beginning of the string. re.search() > matches anywhere in the string. > > $ python > Python 2.7.3 (default, Jun 18 2012, 20:21:41) > [GCC 4.5.3] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import re > >>> re.match(r'/search(?:/opensearch)?$', '/search') > <_sre.SRE_Match object at 0xb76a8020> > >>> re.match(r'/search(?:/opensearch)?$', '/search/opensearch') > <_sre.SRE_Match object at 0xb76a8170> > >>> re.match(r'/search(?:/opensearch)?$', '/search/something') > >>> re.match(r'/search(?:/opensearch)?$', '/my/search') > >>> re.search(r'/search(?:/opensearch)?$', '/my/search') > <_sre.SRE_Match object at 0xb76a8020> Thanks Remy, I have since discovered that the problem is probably with the name of my template: "search.html". Even though it is stored in my plugin folder it gets found before/after the trac one (I've not worked out the priority). Anyway, is there a way to add a path to a html template (like get_htdocs_dirs() allows) or must a plugin's html templates use unique names? ~ mark c -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users [at] googlegroups To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.
|