Created
August 6, 2012 20:41
-
-
Save slinkp/3278240 to your computer and use it in GitHub Desktop.
some json that github issues api doesn't like
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"body": "This code: https://github.com/openplans/openblock/blob/master/ebpub/ebpub/geocoder/base.py#L498\r\n\r\nruns into a few problems when convert_to_block is True. Seems it's been copied from somewhere else but not fully adapted. For easier reference the code is:\r\n\r\n{{{\r\n#!python\r\n except InvalidBlockButValidStreet, e:\r\n # If the exact address couldn't be geocoded, try using the\r\n # normalized location name.\r\n if convert_to_block:\r\n block_name = address_to_block(kwargs['location_name'])\r\n if block_name != kwargs['location_name']:\r\n try:\r\n result = BlockGeocoder._do_geocode(block_name)\r\n result['result']['address'] = block_name\r\n except InvalidBlockButValidStreet, another_e:\r\n pass\r\n except AmbiguousResult, another_e:\r\n pass\r\n # No joy, return all blocks.\r\n logger.debug('Invalid block for %r, returning all possible blocks' % query)\r\n return {'type': 'block', 'result': e.block_list, 'ambiguous': True, 'street_name': e.street_name, 'block_number': e.block_number}\r\n}}}\r\n\r\nFirst we need a `from ebpub.utils.text import address_to_block` before using address_to_block, that's easy.\r\n\r\nI think `kwargs['location_name']` needs to be replaced with `query` throughout.\r\n\r\nWe need an instance of !BlockGeocoder to call `_do_geocode`\r\n\r\n`result['result']['address'] = block_name` generates `KeyError: 'result'`, I think that's maybe supposed to be `result['address'] = block_name`\r\n\r\nAnd in that case where we have a result it needs to be returned somehow?\r\n\r\n\r\n", "milestone": 2, "labels": ["defect", "ebpub", "@@kmtracey"], "title": "convert_to_block=True passed to full_geocode has a few problems"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment