This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description


horae.groupselect provides a grouped Dropdown widget for zope.formlib using the default optgroup elements provided by HTML.


To use a grouped dropdown widget the previously used Choice field of the schema has to be replaced by a GroupedChoice field provided in horae.groupedselect.field. A GroupedChoice field takes the exactly same parameters as the stock Choice field but additionally an instance of a groups provider (implementing horae.groupedselect.interfaces.IGroups) has to be provided over the parameter groups. The mentioned groups provider converts the vocabulary of the field into a list of groups.

Imagine field to select a country and you would like to group them by region:

from zope import interface, implements
from zope.schema import vocabulary

from horae.groupedselect import field, interfaces

class Country(object):
    def __init__(self, region, country):
        self.region = region = country

class CountryGroups(object):

    def groups(self, vocabulary):
        Converts the given vocabulary into a list of groups:

            return (('Group 1', (term1, term2, term3)),
                    ('Group 2', (term6, term5, term6)),)
        groups = {}
        for term in vocabulary:
            if not term.value.region in groups:
                groups[term.value.region] = ()
            groups[term.value.region] = groups[term.value.region] + \
        return groups.items()

class ICountrySelection(interface.Interface):

    country = field.GroupedChoice(
        title = u'Country',
        vocabulary = vocabulary.SimpleVocabulary((
            # ...
                Country(u'Europe', u'Switzerland'),
                Country(u'Europe', u'Germany'),
                Country(u'Europe', u'Austria'),
                Country(u'Europe', u'France'),
            # ...
                Country(u'North America', u'USA'),
                Country(u'Europe', u'Canada'),
            # ...
        groups = CountryGroups()



1.0a1 (2012-01-16)

  • Initial release
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
horae.groupselect-1.0a1.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Jan 16, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting