Back to index

plone3  3.1.7
countries.py
Go to the documentation of this file.
00001 # -*- coding: UTF-8 -*-
00002 
00003 from plone.app.i18n.locales.interfaces import ICountries
00004 from plone.i18n.locales.countries import CountryAvailability
00005 
00006 from zope.interface import implements
00007 
00008 from OFS.SimpleItem import SimpleItem
00009 
00010 class Countries(SimpleItem, CountryAvailability):
00011     """A local utility storing a list of available countries.
00012 
00013     Let's make sure that this implementation actually fulfills the API.
00014 
00015       >>> from zope.interface.verify import verifyClass
00016       >>> verifyClass(ICountries, Countries)
00017       True
00018     """
00019     implements(ICountries)
00020 
00021     id  = 'plone_app_countries'
00022     title = 'Manages available countries'
00023     meta_type = 'Plone App I18N Countries'
00024 
00025     def __init__(self):
00026         self.countries = ['en']
00027 
00028     def getAvailableCountries(self):
00029         """Return a sequence of country tags for available countries.
00030         """
00031         return list(self.countries)
00032 
00033     def setAvailableCountries(self, countries):
00034         """Set a list of available country tags.
00035         """
00036         countries = list(countries)
00037         self.countries = countries