Yet another fix of the patch
This commit is contained in:
parent
e6a0d42125
commit
8686bd9e27
@ -9,15 +9,18 @@
|
|||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'timezone', 'utc', 'country_timezones', 'country_names',
|
'timezone', 'utc', 'country_timezones', 'country_names',
|
||||||
@@ -77,23 +77,16 @@ def open_resource(name):
|
@@ -70,6 +70,10 @@ else: # Python 2.x
|
||||||
Uses the pkg_resources module if available and no standard file
|
"""
|
||||||
found at the calculated location.
|
return s.encode('ASCII')
|
||||||
"""
|
|
||||||
+ _tzinfo_dir = os.getenv("TZDIR") or "/usr/share/zoneinfo"
|
+_tzinfo_dir = os.getenv("TZDIR") or "/usr/share/zoneinfo"
|
||||||
+ if _tzinfo_dir.endswith(os.sep):
|
+if _tzinfo_dir.endswith(os.sep):
|
||||||
+ _tzinfo_dir = _tzinfo_dir[:-1]
|
+ _tzinfo_dir = _tzinfo_dir[:-1]
|
||||||
+
|
+
|
||||||
name_parts = name.lstrip('/').split('/')
|
|
||||||
|
def open_resource(name):
|
||||||
|
"""Open a resource from the zoneinfo subdir for reading.
|
||||||
|
@@ -81,19 +85,8 @@ def open_resource(name):
|
||||||
for part in name_parts:
|
for part in name_parts:
|
||||||
if part == os.path.pardir or os.path.sep in part:
|
if part == os.path.pardir or os.path.sep in part:
|
||||||
raise ValueError('Bad path segment: %r' % part)
|
raise ValueError('Bad path segment: %r' % part)
|
||||||
|
Loading…
Reference in New Issue
Block a user