OpenQuizz
Une application de gestion des contenus pédagogiques
_CountryTimezoneDict Class Reference
Inheritance diagram for _CountryTimezoneDict:
Collaboration diagram for _CountryTimezoneDict:

Public Member Functions

def __call__ (self, iso3166_code)
 
- Public Member Functions inherited from LazyDict
def __getitem__ (self, key)
 
def __contains__ (self, key)
 
def __iter__ (self)
 
def __len__ (self)
 
def keys (self)
 

Data Fields

 data
 

Additional Inherited Members

- Static Public Attributes inherited from LazyDict
 data
 

Detailed Description

Map ISO 3166 country code to a list of timezone names commonly used
in that country.

iso3166_code is the two letter code used to identify the country.

>>> def print_list(list_of_strings):
...     'We use a helper so doctests work under Python 2.3 -> 3.x'
...     for s in list_of_strings:
...         print(s)

>>> print_list(country_timezones['nz'])
Pacific/Auckland
Pacific/Chatham
>>> print_list(country_timezones['ch'])
Europe/Zurich
>>> print_list(country_timezones['CH'])
Europe/Zurich
>>> print_list(country_timezones[unicode('ch')])
Europe/Zurich
>>> print_list(country_timezones['XXX'])
Traceback (most recent call last):
...
KeyError: 'XXX'

Previously, this information was exposed as a function rather than a
dictionary. This is still supported::

>>> print_list(country_timezones('nz'))
Pacific/Auckland
Pacific/Chatham

Member Function Documentation

◆ __call__()

def __call__ (   self,
  iso3166_code 
)
Backwards compatibility.

Field Documentation

◆ data

data

The documentation for this class was generated from the following file: