def SearchView(request): chain = SearchFilterChain(request) search_args = {} for key in request.GET: if not chain.filters_key(key): search_args[key] = request.GET.getlist(key) search_args = chain.filter_args(search_args) json = Spot(None, request=request).search(search_args) json = simplejson.dumps(json) return HttpResponse(json, content_type='application/json')
def SearchView(request): # Required settings for the client if not hasattr(settings, 'SS_WEB_SERVER_HOST'): raise(Exception("Required setting missing: SS_WEB_SERVER_HOST")) if not hasattr(settings, 'SS_WEB_OAUTH_KEY'): raise(Exception("Required setting missing: SS_WEB_OAUTH_KEY")) if not hasattr(settings, 'SS_WEB_OAUTH_SECRET'): raise(Exception("Required setting missing: SS_WEB_OAUTH_SECRET")) chain = SearchFilterChain(request) consumer = oauth2.Consumer( key=settings.SS_WEB_OAUTH_KEY, secret=settings.SS_WEB_OAUTH_SECRET ) client = oauth2.Client(consumer) search_args = {} for key in request.GET: if not chain.filters_key(key): search_args[key] = request.GET.getlist(key) search_args = chain.filter_args(search_args) json = get_space_search_json(client, search_args) json = simplejson.loads(json) i18n_json = [] for space in json: string_val = '' for x in range(0, len(space['type'])): if x is 0: string_val = _(space['type'][x]) else: string_val = string_val + ', ' + _(space['type'][x]) space['type'] = string_val i18n_json.append(space) json = simplejson.dumps(i18n_json) response = HttpResponse(json) response["Content-type"] = "application/json" return response
def SearchView(request): # Required settings for the client if not hasattr(settings, 'SS_WEB_SERVER_HOST'): raise(Exception("Required setting missing: SS_WEB_SERVER_HOST")) if not hasattr(settings, 'SS_WEB_OAUTH_KEY'): raise(Exception("Required setting missing: SS_WEB_OAUTH_KEY")) if not hasattr(settings, 'SS_WEB_OAUTH_SECRET'): raise(Exception("Required setting missing: SS_WEB_OAUTH_SECRET")) chain = SearchFilterChain(request) consumer = oauth2.Consumer(key=settings.SS_WEB_OAUTH_KEY, secret=settings.SS_WEB_OAUTH_SECRET) client = oauth2.Client(consumer) search_args = {} for key in request.GET: if not chain.filters_key(key): search_args[key] = request.GET.getlist(key) search_args = chain.filter_args(search_args) json = get_space_search_json(client, search_args) json = simplejson.loads(json) i18n_json = [] for space in json: string_val = '' for x in range(0, len(space['type'])): if x is 0: string_val = _(space['type'][x]) else: string_val = string_val + ', ' + _(space['type'][x]) space['type'] = string_val i18n_json.append(space) json = simplejson.dumps(i18n_json) response = HttpResponse(json) response["Content-type"] = "application/json" return response