Ticket #261 (closed defect: fixed)
Allow streets outside of a city (eg. unincorporated areas)
| Reported by: | slinkp | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | OpenBlock 1.2 |
| Component: | ebpub | Version: | 1.1 |
| Keywords: | openblock-rural | Cc: | |
| Sensitive: | no |
Description
During openblock-rural sprint, we imported some streets without the --city parameter. But you can't actually browse to a city-less block - if you do you get this:
Traceback:
File "/home/openrural/www/staging/env/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/home/openrural/www/staging/env/lib/python2.6/site-packages/ebpub/db/views.py" in place_detail_timeline
995. filterchain.add('location', context['place'])
File "/home/openrural/www/staging/env/lib/python2.6/site-packages/ebpub/db/schemafilters.py" in add
839. val = BlockFilter(self.request, self.context, self.qs, *values, block=block)
File "/home/openrural/www/staging/env/lib/python2.6/site-packages/ebpub/db/schemafilters.py" in __init__
435. self._update_block(kwargs['block'])
File "/home/openrural/www/staging/env/lib/python2.6/site-packages/ebpub/db/schemafilters.py" in _update_block
380. self.city_slug = block.city # XXX is that a slug?
File "/home/openrural/www/staging/env/lib/python2.6/site-packages/ebpub/streets/models.py" in city
342. self._city_cache = proper_city(self)
File "/home/openrural/www/staging/env/lib/python2.6/site-packages/ebpub/streets/models.py" in proper_city
81. raise ImproperCity("Error: Unknown city '%s' from block %s (%s)" % (block.left_city, block.id, block))
Exception Type: ImproperCity at /streets/1001/101-274-/
Exception Value: Error: Unknown city '' from block 4128 (101-274 1001)
Unfortunately, block.city is needed for building URLs in a multi-city configuration.
Maybe for that case we'd need a special "non-city" location, and some way to tell import_blocks_esri (or the admin UI) what ?
There used to be an undocumented sql script for creating special "unknown [city/town/zip/...]" placeholder locations, at ebpub/ebpub/db/sql/unknown_locations.sql
which was removed in commit 13151acef5198f5bea5dd93022d8d97d9c5151a8
Something like that would have to be run by a trigger or signal every time you create a new LocationType?, and there'd have to be logic sprinkled around to associate NewsItems? with the unknown location by default.

Closely related - what to do with blocks that have a city name but it's not one we know about?
Currently that triggers the same exception.