Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Interface marker field for Archetypes

Project Description

Introduction

This packages contains a single Archetypes field that can manage one or more marker interface on an object.

It is most often used with archetypes.schemaextender to add a field to a type which controls new optional behaviour.

Example

This example adds a new item to the settings fieldset for an object which controls an ICategory marker interface:

class FolderExtender(object):
    """Add a new 'category' field to all Archetypes based folder types.
    """
    adapts(IBaseFolder)
    implements(ISchemaExtender)

    fields = [
            InterfaceMarkerField("category",
                schemata = "settings",
                interfaces = (ICategory,),
                widget = BooleanWidget(
                    title = _(u"label_category",
                                default=u"Is this folder a category."),
                    description = _(u"help_category",
                                default=u"This should briefly explain what "
                                        u"categories are used for."),
                    ),
                ),
            ]


    def __init__(self, context):
        self.context = context


    def getFields(self):
        return self.fields

Changelog

1.1 - 2011-04-07

  • Extracted a non-schemaextender version of the field to its own class. [hannosch]
  • PEP8 cleanup. [hannosch]

1.0 - 2008-11-06

  • Initial release [wichert]
Release History

Release History

This version
History Node

1.1

History Node

1.0

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
archetypes.markerfield-1.1.zip (8.0 kB) Copy SHA256 Checksum SHA256 Source Apr 7, 2011

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