コード例 #1
0
ファイル: utils.py プロジェクト: WhitespaceCrew/django-htk
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
ファイル: utils.py プロジェクト: yacine15/django-htk
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
ファイル: models.py プロジェクト: teamwinit/django-htk
 def seo_title(self):
     title = '%s' % self.name
     seo_title = seo_tokenize(title, lower=True)
     return seo_title
コード例 #4
0
ファイル: models.py プロジェクト: WhitespaceCrew/django-htk
 def get_seo_title(self):
     title = '%s' % self.name
     seo_title = seo_tokenize(title, lower=True)
     return seo_title