def new_function(*args, **kwargs):
		detected_location = None
		if request.method == "GET":
			city = request.args.get('city', None)
			longitude = request.args.get('longitude', None)
			latitude = request.args.get('latitude', None)
		elif request.method == "POST":
			city = request.form.get('city', None)
			longitude = request.form.get('longitude', None)
			latitude = request.form.get('latitude', None)

		if city != None and longitude != None and latitude != None:
			try:
				longitude_parsed = float(longitude)
				latitude_parsed = float(latitude)

				detected_location = Location(city, longitude_parsed, latitude_parsed)
			except ValueError:
				pass	#TODO Log me
		
		if detected_location == None:
			detected_location = location_service.get_geoip_location(request.remote_addr)

		if detected_location != None:
			g.user_location = detected_location

			return original_function(*args, **kwargs)
		else:
			return { error : true, message : "Could not detect location" }, 400
def get_geoip_location():
	ip_address = request.remote_addr

	current_location = location_service.get_geoip_location(ip_address)

	return current_location.to_json_dict()