metashare / META-SHARE

Public repository of the META-SHARE software
http://www.meta-share.eu/
Other
23 stars 31 forks source link

Avoid 500 server error with IPv6 addresses (GeoIP) #754

Closed zeehio closed 10 years ago

zeehio commented 10 years ago

I get 500 Server errors when searching for resources with a non-empty string. With DEBUG=True I can get the exception: Invalid database type; expected IPv4 address which is backtraced to the getcountry_code function in the stats/geoip.py file.

The proposed try/except patch fixes the issue by returning the default empty string if geoip cannot find the country.

As far as I know, this is used for statistic purposes, so providing the country guessed by the IP it is not crucial for metashare.