Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

added missing relaodifnecessary to geoip plugin #7

Merged
merged 1 commit into from

2 participants

@neonknight
Collaborator

No description provided.

@gryphius gryphius merged commit b2caed0 into gryphius:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2013
  1. added missing reloadifnecessary

    neonknight authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/postomaat/plugins/geoip.py
View
5 src/postomaat/plugins/geoip.py
@@ -40,11 +40,10 @@ def __init__(self, filename, **kw):
self.logger=logging.getLogger(str(self))
if not hasattr(self,'lastreload'):
self.lastreload=0
- self.file = filename
self._initlocal(**kw)
- self.reloadifnecessary(self.file)
+ self.reloadifnecessary(filename)
def reloadifnecessary(self, filename):
@@ -88,6 +87,7 @@ def _reallyloadData(self, filename):
def country_code(self, ip):
+ self.reloadifnecessary(self.filename)
cc = u''
try:
cc = self.geoip.country_code_by_addr(ip)
@@ -96,6 +96,7 @@ def country_code(self, ip):
return cc
def country_name(self, cc):
+ self.reloadifnecessary(self.filename)
country = 'unknown'
if cc:
i = pygeoip.const.COUNTRY_CODES.index(cc)
Something went wrong with that request. Please try again.