Пример #1
0
def get_latlng(location_name):
    """Geocodes a `location_name` and caches the result

    For now, uses Google maps geocode API
    """
    prekey = seo_tokenize(location_name)
    c = GeocodeCache(prekey=prekey)
    latlng = c.get()
    if latlng is None:
        latlng = get_latlng_google(location_name)
        if latlng is None:
            # an exception occurred; possibly hit Google API limit
            latlng = (None, None,)
        else:
            c.cache_store(latlng)
    return latlng
Пример #2
0
def get_latlng(location_name):
    """Geocodes a `location_name` and caches the result

    For now, uses Google maps geocode API
    """
    prekey = seo_tokenize(location_name)
    c = GeocodeCache(prekey=prekey)
    latlng = c.get()
    if latlng is None:
        latlng = get_latlng_google(location_name)
        if latlng is None:
            # an exception occurred; possibly hit Google API limit
            latlng = (
                None,
                None,
            )
        else:
            c.cache_store(latlng)
    return latlng
Пример #3
0
 def seo_title(self):
     title = '%s' % self.name
     seo_title = seo_tokenize(title, lower=True)
     return seo_title
Пример #4
0
 def get_seo_title(self):
     title = '%s' % self.name
     seo_title = seo_tokenize(title, lower=True)
     return seo_title