All pastes #1435449 Raw Edit

Something

public text v1 · immutable
#1435449 ·published 2009-05-26 21:22 UTC
rendered paste body
        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]