Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Commit 22208ac

Browse files
committed
remove redundant code
country_code parameter was defined for no good reason in the index view. Getting the country directly from the user_ip seems to do the same job.
1 parent 3c646d9 commit 22208ac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

web/views/events.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from web.processors.event import get_lat_lon_from_user_ip
2828
from web.processors.event import list_countries
2929
from web.processors.event import get_country
30+
from web.processors.event import get_country_from_user_ip
3031
from web.processors.media import process_image
3132
from web.processors.media import ImageSizeTooLargeException
3233
from web.processors.media import UploadImageError
@@ -42,7 +43,7 @@
4243
"""
4344

4445

45-
def index(request, country_code=None):
46+
def index(request):
4647
template = 'pages/index.html'
4748

4849
past = request.GET.get('past', 'no')
@@ -55,7 +56,8 @@ def index(request, country_code=None):
5556
user_ip = get_client_ip(forwarded=request.META.get('HTTP_X_FORWARDED_FOR'),
5657
remote=request.META.get('REMOTE_ADDR'))
5758

58-
country = get_country(country_code, user_ip)
59+
country_code = None
60+
country = get_country_from_user_ip(user_ip)
5961

6062
try:
6163
lan_lon = get_lat_lon_from_user_ip(user_ip)

0 commit comments

Comments
 (0)