Changeset 486:bc4d2b8e3009
- Timestamp:
- 01/23/10 10:13:48 (8 weeks ago)
- Author:
- rgrp <http://rufuspollock.org>
- Branch:
- default
- Message:
-
[model,misc][s]: change model.types.GeometryPlain? so that on load from db None is converted to default 'empty' Point feature (already convert empty feature back to None on saving to db).
- Main reason for doing this was it seemed lack of Feature structure on Factlets with no location was what was breaking showing "Select location on map" thread edit view (due to element fill issues i think ...)
- Also location editor itself is broken when no long/lat. Have fix for this (not yet committed) but need to check when online.
- microfacts/getdata/dbpedia.py, microfacts/lib/base.py, microfacts/model/core.py:
- We already had this empty point Feature as default_location attribute on Factlet which we can now deprecate in favour of GeometryPlain?.default_feature
- Location:
- microfacts
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r465
|
r486
|
|
| 178 | 178 | 'place': [], # holding item for locations |
| 179 | 179 | # NB: model code takes care of ignoring empty (default) location |
| 180 | | 'location': model.Factlet.default_location, |
| | 180 | 'location': model.GeometryPlain.default_feature, |
| 181 | 181 | 'image_urls': [], |
| 182 | 182 | 'license': u'CC-BY-SA' |
-
|
r463
|
r486
|
|
| 26 | 26 | def __getattr__(self, name): |
| 27 | 27 | attrs = dict(id=0, title='', image='', description='', |
| 28 | | start='', end='', location=model.Factlet.default_location, |
| | 28 | start='', end='', |
| | 29 | location=model.GeometryPlain.default_feature, |
| 29 | 30 | source='', license='', state='', revision='', |
| 30 | 31 | blank_factlet=True) |
-
|
r484
|
r486
|
|
| 146 | 146 | text_search_fields = [ 'title', 'description' ] |
| 147 | 147 | |
| 148 | | default_location = geojson.Feature( |
| 149 | | properties=dict(title=u''), |
| 150 | | geometry=geojson.Point(coordinates=[None,None]) |
| 151 | | ) |
| 152 | | |
| 153 | 148 | import swiss.date |
| 154 | 149 | def add_flexidate(domain_object, name): |
-
|
r462
|
r486
|
|
| 32 | 32 | # return "SRID=%s;%s" % (self.srid, value.wkb.encode('hex')) |
| 33 | 33 | |
| | 34 | default_feature = geojson.Feature( |
| | 35 | properties=dict(title=u''), |
| | 36 | geometry=geojson.Point(coordinates=[None,None]) |
| | 37 | ) |
| | 38 | |
| 34 | 39 | def convert_result_value(self, value, engine): |
| 35 | 40 | if value is None: |
| 36 | | return None |
| | 41 | return self.default_feature |
| 37 | 42 | else: |
| 38 | 43 | # Temporary hack for old-style as we switch to geojson |
-
|
r481
|
r486
|
|
| 32 | 32 | </dl> |
| 33 | 33 | |
| 34 | | <div class="location" py:with="ourlocation = c.factlet.location if |
| 35 | | c.factlet.location else c.factlet.default_location"> |
| | 34 | <div class="location" py:with="ourlocation = c.factlet.location"> |
| 36 | 35 | ${gmaps()} |
| 37 | 36 | ${h.hidden('location[type]', value=ourlocation['type'], class_='type')} |