Changeset 59 for ATGoogleMaps


Ignore:
Timestamp:
07/11/06 23:57:54 (6 years ago)
Author:
takanori
Message:

latlng フィールドを辞書型に変更

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ATGoogleMaps/trunk/field.py

    r44 r59  
    1313    _properties = Field._properties.copy() 
    1414    _properties.update({ 
    15         'type' : 'latlng', 
     15        'type': 'latlng', 
     16        'default': {}, 
    1617        'size': 12, 
    1718        'default': None, 
     
    2728            float(value.latitude) 
    2829            float(value.longitude) 
    29         except: 
     30        except (ValueError, TypeError): 
    3031            result = False 
    3132        else: 
     
    3536    security.declarePrivate('get') 
    3637    def get(self, instance, **kwargs): 
    37         value = ObjectField.get(self, instance, **kwargs) 
    38         return value 
     38        return ObjectField.get(self, instance, **kwargs) 
    3939 
    4040    security.declarePrivate('set') 
    4141    def set(self, instance, value, **kwargs): 
     42        if type(value) != type({}) and hasattr(value, 'keys'): 
     43            new_value = {} 
     44            new_value.update(value) 
     45            value = new_value 
     46             
    4247        ObjectField.set(self, instance, value, **kwargs) 
    4348 
     
    4651registerField(LatLngField, 
    4752              title="LatLng", 
    48               description="Used to store latitude and longitude.", 
     53              description="Used to store longitude and longitude.", 
    4954              ) 
    5055 
Note: See TracChangeset for help on using the changeset viewer.