Exemple #1
0
def _get_config(admin):
    venue = admin.venue.get() if admin.venue else None
    active_venues = Venue.query(Venue.active == True).fetch()
    return {
        'venue': venue.dict() if venue else None,
        'login': admin.login,
        'app_name': config.APP_NAME,
        'app_kind': config.APP_KIND,
        'delivery_types': _get_delivery_types(venue),
        'venues': [v.dict() for v in active_venues],
        'venue_id': admin.venue.id() if admin.venue else None,
        'google_analytics_api_key_ios': config.GOOGLE_ANALYTICS_API_KEY_IOS,
        'google_analytics_api_key_android':
        config.GOOGLE_ANALYTICS_API_KEY_ANDROID
    }
Exemple #2
0
def get_company_cities():
    companies = AutomationCompany.query(AutomationCompany.status == STATUS_AVAILABLE).fetch()
    if companies:
        return [city.dict() for city in ProxyCity.query(ProxyCity.status == STATUS_AVAILABLE).fetch()]
    else:
        found = False
        for venue in Venue.query(Venue.active == True).fetch():
            if MenuItem.query(MenuItem.restrictions.IN((venue.key,))).get():
                found = True
        if not found:
            return []
        cities = Venue.get_cities()
        if len(cities) > 1:
            return [{
                'city': city,
                'id': base64.b64encode(city.encode('utf-8'))
            } for city in cities]
        else:
            return []