Skip to main content

Zope 3 sources for pycountry databases

Project description

This package lets you use the pycountry database within Zope 3.

In practice, this means e.g., that you can easily get a zope.schema.Choice field to provide a full list of iso 3166 country codes.

For more information about the database please refer to the pycountry product. provides Zope 3 sources for the pycountry databases. You can use it e.g. to get a zope.schema.Choice field with all iso 3166 countries.

>>> import

ISO 3166 countries

For the iso 3166 countries, use the gocept.pycountry.countries sourcefactory:

>>> country_source =
>>> country_source
<zc.sourcefactory.source.FactoredSource object at 0x...>

Use the getValues() method to get an countries iterator:

>>> country_iterator = country_source.factory.getValues()
>>> country_iterator
<listiterator object at 0x...>

That iterator can be used to retrieve the countries:

>>> afghanistan =
>>> afghanistan
<pycountry.db.Country object at 0x...>

The method getTitle(country) returns the iso 3166 name of a country. getToken(country) returns the alpha 2 value of the given country.

>>> country_source.factory.getTitle(afghanistan)
>>> country_source.factory.getToken(afghanistan)

ISO 639 languages

The iso 639 languages are available similar to the countries:

>>> afar =
>>> afar
<pycountry.db.Language object at 0x...>

ISO 15924 scripts

The iso 14924 scripts are available similar to the countries:

>>> arabic =
>>> arabic
<pycountry.db.Script object at 0x...>

ISO 4217 currencies

The iso 4217 currencies are available similar to the countries:

>>> dirham =
>>> dirham
<pycountry.db.Currency object at 0x...>
u'UAE Dirham'


0.2 (unreleased)

0.1 (2008-05-20)

  • initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (5.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page