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
5e4af47e
Commit
5e4af47e
authored
Sep 24, 2012
by
William Tisäter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize and refactor internal seek functions
parent
e0a63175
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
7 deletions
+13
-7
pygeoip/__init__.py
+0
-0
pygeoip/const.py
+6
-1
pygeoip/timezone.py
+5
-5
tests/test_city.py
+2
-1
No files found.
pygeoip/__init__.py
View file @
5e4af47e
This diff is collapsed.
Click to expand it.
pygeoip/const.py
View file @
5e4af47e
...
...
@@ -362,11 +362,16 @@ CITY_EDITION_REV0 = 6
CITY_EDITION_REV1
=
2
ORG_EDITION
=
5
ISP_EDITION
=
4
PROXY_EDITION
=
8
ASNUM_EDITION
=
9
# Not yet supported databases
PROXY_EDITION
=
8
NETSPEED_EDITION
=
11
COUNTRY_EDITION_V6
=
12
# Collection of databases
CITY_EDITIONS
=
(
CITY_EDITION_REV0
,
CITY_EDITION_REV1
)
REGION_EDITIONS
=
(
REGION_EDITION_REV0
,
REGION_EDITION_REV1
)
SEGMENT_RECORD_LENGTH
=
3
STANDARD_RECORD_LENGTH
=
3
ORG_RECORD_LENGTH
=
4
...
...
pygeoip/timezone.py
View file @
5e4af47e
...
...
@@ -699,17 +699,17 @@ _country["ZW"] = "Africa/Harare"
def
time_zone_by_country_and_region
(
country_code
,
region_name
=
None
):
if
country_code
not
in
_country
:
return
None
return
''
if
not
region_name
or
region_name
==
'00'
:
region_name
=
None
timezones
=
_country
[
country_code
]
if
isinstance
(
timezones
,
str
):
return
timezones
if
region_name
:
return
timezones
.
get
(
region_name
)
if
not
region_name
:
return
''
return
timezones
.
get
(
region_name
)
tests/test_city.py
View file @
5e4af47e
...
...
@@ -40,7 +40,8 @@ class TestGeoIPCityFunctions(unittest.TestCase):
'longitude'
:
-
0.23339999999998895
,
'country_code3'
:
'GBR'
,
'latitude'
:
51.283299999999997
,
'postal_code'
:
None
,
'dma_code'
:
0
,
'postal_code'
:
''
,
'dma_code'
:
0
,
'country_code'
:
'GB'
,
'country_name'
:
'United Kingdom'
,
'time_zone'
:
'Europe/London'
...
...
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