def get_sites(): query = {} url = request.args.get('url') if url: query['url'] = url sitez = [sanitize_site(site) for site in sites.find(query)] for site in sitez: site['groups'] = _find_groups_for_site(site['url']) return jsonify(success=True, sites=sitez)
def _check_plan_by_email(email, plan_name): plan = plans.find_one({'name': plan_name}) if not plan: return False sitez = sites.find({'plans': plan_name}) if sitez.count(): matches = 0 for site in sitez: groupz = groups.find({'users': email, 'sites': site['url']}) if groupz.count(): matches += 1 return matches
def get_sites(): query_url = request.args.get('url') if query_url: site = sites.find_one({'url': query_url}) if site: site['groups'] = _find_groups_for_site(site['url']) return jsonify(success=True, site=sanitize_site(site)) else: jsonify(success=True, site=[]) else: sitez = [sanitize_site(site) for site in sites.find()] for site in sitez: site['groups'] = _find_groups_for_site(site['url']) return jsonify(success=True, sites=sitez)
def list_sites(): sitez = [sanitize_site(site) for site in sites.find()] for site in sitez: site['groups'] = _find_groups_for_site(site['url']) return jsonify(success=True, sites=sitez)