Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pygeoip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pygeoip
Commits
a7c76a6f
Commit
a7c76a6f
authored
Jul 15, 2013
by
Kiril Zyapkov
Committed by
William Tisäter
Jul 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable use in Google AppEngine
parent
2b314f4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
pygeoip/__init__.py
+11
-2
No files found.
pygeoip/__init__.py
View file @
a7c76a6f
...
...
@@ -26,11 +26,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>.
import
os
import
math
import
socket
import
mmap
import
codecs
from
threading
import
Lock
try
:
import
mmap
except
ImportError
:
mmap
=
None
try
:
from
StringIO
import
StringIO
except
ImportError
:
from
io
import
StringIO
,
BytesIO
...
...
@@ -93,7 +97,12 @@ class GeoIP(GeoIPBase):
self
.
_filename
=
filename
self
.
_flags
=
flags
if
self
.
_flags
&
const
.
MMAP_CACHE
:
if
self
.
_flags
&
const
.
MMAP_CACHE
and
mmap
is
None
:
import
warnings
warnings
.
warn
(
"MMAP_CACHE cannot be used without a mmap module"
)
self
.
_flags
&=
~
const
.
MMAP_CACHE
elif
self
.
_flags
&
const
.
MMAP_CACHE
:
f
=
open
(
filename
,
'rb'
)
access
=
mmap
.
ACCESS_READ
self
.
_filehandle
=
mmap
.
mmap
(
f
.
fileno
(),
0
,
access
=
access
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment