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
6edc9d97
Commit
6edc9d97
authored
Jul 16, 2013
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make internal cache class private
parent
06509cce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
pygeoip/__init__.py
+9
-13
No files found.
pygeoip/__init__.py
View file @
6edc9d97
...
...
@@ -51,18 +51,10 @@ MEMORY_CACHE = const.MEMORY_CACHE
ENCODING
=
const
.
ENCODING
class
GeoIPError
(
Exception
):
pass
class
GeoIPMetaclass
(
type
):
class
_GeoIPMetaclass
(
type
):
def
__new__
(
cls
,
*
args
,
**
kwargs
):
"""
Singleton method to gets an instance without reparsing the db. Unique
instances are instantiated based on the filename of the db. Flags are
ignored for this, i.e. if you initialize one with STANDARD
flag (default) and then try later to initialize with MEMORY_CACHE, it
will still return the STANDARD one.
""" Singleton method to gets an instance without reparsing
the database, the filename is being used as cache key.
"""
if
not
hasattr
(
cls
,
'_instances'
):
cls
.
_instances
=
{}
...
...
@@ -78,10 +70,14 @@ class GeoIPMetaclass(type):
return
cls
.
_instances
[
filename
]
GeoIPBase
=
GeoIPMetaclass
(
'GeoIPBase'
,
(
object
,),
{})
_GeoIPBase
=
_GeoIPMetaclass
(
'GeoIPBase'
,
(
object
,),
{})
class
GeoIPError
(
Exception
):
pass
class
GeoIP
(
GeoIPBase
):
class
GeoIP
(
_
GeoIPBase
):
def
__init__
(
self
,
filename
,
flags
=
0
):
"""
Initialize the class.
...
...
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