示例#1
0
def find_city_by_name(name):
    try:
        city = storage.search_cities(
            query_builder.build_from_name(name),
            fields=['guide','cid','name','weather'])[0]
    except IndexError:
        return
    print 'found', city['name'].encode('utf8'), city['cid']
    return city
    
示例#2
0
def from_guide(guide, **options):
    paging_options = {p:options.pop(p) for p in storage.PAGING_OPTIONS if p in options}
    query = query_builder.build_from_guide(guide, **options)
    return storage.search_cities(query, **paging_options)