New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Oct 28, 2014

Conversation

Projects
None yet
2 participants
@zeehio
Copy link
Contributor

zeehio commented Oct 17, 2014

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.

Avoid 500 server error with IPv6 addresses (GeoIP)
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.

jsteffen added a commit that referenced this pull request Oct 28, 2014

Merge pull request #754 from zeehio/patch-1
Avoid 500 server error with IPv6 addresses (GeoIP)

@jsteffen jsteffen merged commit 1512cfc into metashare:master Oct 28, 2014

@zeehio zeehio deleted the zeehio:patch-1 branch Mar 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment