if not globals()['patched']:
def patched_href_call(self, *args, **kw):
frame = sys._getframe().f_back.f_back
code = frame.f_code
if code.co_name == 'get_href' and code.co_filename == trac.ticket.query.__file__.rstrip('c'):
try:
kw.update(self.geo_query_kw)
except TypeError: # XXX even more scary!
pass
return original_href_call(self, *args, **kw)
Href.__call__ = patched_href_call
globals()['patched'] = True
if req.path_info == '/query' and 'update' in req.args:
match = False
for i in 'center-location', 'radius':
if i in req.args:
if not match:
req.href.geo_query_kw = {}
req.href.geo_query_kw[i] = req.args[i]