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
244f26dc
Commit
244f26dc
authored
Sep 25, 2012
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify confusing not in statements
parent
57cd341b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
pygeoip/__init__.py
+5
-7
No files found.
pygeoip/__init__.py
View file @
244f26dc
...
...
@@ -75,7 +75,7 @@ class GeoIPMetaclass(type):
elif
'filename'
in
kwargs
:
filename
=
kwargs
[
'filename'
]
if
not
filename
in
cls
.
_instances
:
if
filename
not
in
cls
.
_instances
:
cls
.
_instances
[
filename
]
=
type
.
__new__
(
cls
,
*
args
,
**
kwargs
)
return
cls
.
_instances
[
filename
]
...
...
@@ -507,7 +507,7 @@ class GeoIP(GeoIPBase):
if
not
ipnum
:
raise
ValueError
(
'Invalid IP address'
)
if
not
self
.
_databaseType
in
const
.
CITY_EDITIONS
:
if
self
.
_databaseType
not
in
const
.
CITY_EDITIONS
:
message
=
'Invalid database type, expected City'
raise
GeoIPError
(
message
)
...
...
@@ -545,8 +545,7 @@ class GeoIP(GeoIPBase):
if
not
ipnum
:
raise
ValueError
(
'Invalid IP address'
)
db_type
=
self
.
_databaseType
if
not
db_type
in
const
.
REGION_CITY_EDITIONS
:
if
self
.
_databaseType
not
in
const
.
REGION_CITY_EDITIONS
:
message
=
'Invalid database type, expected Region or City'
raise
GeoIPError
(
message
)
...
...
@@ -582,9 +581,8 @@ class GeoIP(GeoIPBase):
if
not
ipnum
:
raise
ValueError
(
'Invalid IP address'
)
db_type
=
self
.
_databaseType
if
not
db_type
in
const
.
REGION_CITY_EDITIONS
:
message
=
'Invalid database type, expected Region or City'
if
self
.
_databaseType
not
in
const
.
CITY_EDITIONS
:
message
=
'Invalid database type, expected City'
raise
GeoIPError
(
message
)
return
self
.
_get_record
(
ipnum
)[
'time_zone'
]
...
...
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