File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,13 @@ def return_zip_to_location(session: Session) -> Optional[str]:
32
32
Returns:
33
33
A zip number for the user location.
34
34
"""
35
- response = requests .get ("http://ipinfo.io/json" ). json ()
35
+ response = requests .get ("http://ipinfo.io/json" )
36
36
if not response .ok :
37
37
return None
38
+ location_by_ip = response .json ()
38
39
for location in session .query (Location ).all ():
39
- if (location .city == response ["city" ]
40
- and location .country == response ["country" ]):
40
+ if (location .city == location_by_ip ["city" ]
41
+ and location .country == location_by_ip ["country" ]):
41
42
return location .zip_number
42
43
43
44
Original file line number Diff line number Diff line change @@ -212,11 +212,15 @@ async def dayview(
212
212
current_time_with_attrs = CurrentTimeAttributes (date = day )
213
213
inter_day = international_days .get_international_day_per_day (session , day )
214
214
location_and_shabbat = locations .get_user_location (session )
215
- location = location_and_shabbat ["location" ]["title" ]
216
- shabbat_obj = shabbat .get_shabbat_if_date_friday (
217
- location_and_shabbat ,
218
- day .date (),
219
- )
215
+ if location_and_shabbat :
216
+ location = location_and_shabbat ["location" ]["title" ]
217
+ shabbat_obj = shabbat .get_shabbat_if_date_friday (
218
+ location_and_shabbat ,
219
+ day .date (),
220
+ )
221
+ else :
222
+ location = None
223
+ shabbat_obj = None
220
224
month = day .strftime ("%B" ).upper ()
221
225
return templates .TemplateResponse (
222
226
"calendar_day_view.html" ,
You can’t perform that action at this time.
0 commit comments