Changeset 486:bc4d2b8e3009

Show
Ignore:
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:
5 modified

Legend:

Unmodified
Added
Removed
  • microfacts/getdata/dbpedia.py

    r465 r486  
    178178                'place': [], # holding item for locations 
    179179                # NB: model code takes care of ignoring empty (default) location  
    180                 'location': model.Factlet.default_location, 
     180                'location': model.GeometryPlain.default_feature, 
    181181                'image_urls': [], 
    182182                'license':  u'CC-BY-SA' 
  • microfacts/lib/base.py

    r463 r486  
    2626    def __getattr__(self, name): 
    2727        attrs = dict(id=0, title='', image='', description='', 
    28                      start='', end='', location=model.Factlet.default_location, 
     28                     start='', end='', 
     29                     location=model.GeometryPlain.default_feature, 
    2930                     source='', license='', state='', revision='', 
    3031                     blank_factlet=True) 
  • microfacts/model/core.py

    r484 r486  
    146146    text_search_fields = [ 'title', 'description' ] 
    147147 
    148     default_location = geojson.Feature( 
    149         properties=dict(title=u''), 
    150         geometry=geojson.Point(coordinates=[None,None]) 
    151         ) 
    152  
    153148import swiss.date 
    154149def add_flexidate(domain_object, name): 
  • microfacts/model/types.py

    r462 r486  
    3232            # return "SRID=%s;%s" % (self.srid, value.wkb.encode('hex')) 
    3333 
     34    default_feature = geojson.Feature( 
     35        properties=dict(title=u''), 
     36        geometry=geojson.Point(coordinates=[None,None]) 
     37        ) 
     38 
    3439    def convert_result_value(self, value, engine): 
    3540        if value is None: 
    36             return None 
     41            return self.default_feature 
    3742        else: 
    3843            # Temporary hack for old-style as we switch to geojson 
  • microfacts/templates/factlet/edit_core.html

    r481 r486  
    3232      </dl> 
    3333 
    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"> 
    3635        ${gmaps()} 
    3736        ${h.hidden('location[type]', value=ourlocation['type'], class_='type')}