We support several field-level tags (at schema definition), but is both error-prone and difficult to document all these options as tags. Maybe hide them under patched Field methods, so that they are documented as "extended" Field methods.
E.g:
class TagDefinition(object):
class Tag(object):
def __init__(self, field):
self.field = field
# Provide methods for actual configuration
def link_to(self, name):
self.field.setTaggedValue('links-to', name)
def format(self, name, opts):
self.field.setTaggedValue('format:%s' % name, opts)
def __init__(self): pass
def __get__(self, field, fieldtype=None):
return self.Tag(field)
def __set__(self, field, value):
raise AttributeError('Not meant to be set')
# Patch with a config descriptor: Let the monkeys go wild
Field.config = TagDefinition()
class IFoo(Interface):
# Tag actual fields
abstract = zope.schema.Text(title=u'Abstract')
abstract.config.link_to("notes")
abstract.config.format("markup", {'descend': False})
We support several field-level tags (at schema definition), but is both error-prone and difficult to document all these options as tags. Maybe hide them under patched
Field
methods, so that they are documented as "extended"Field
methods.E.g: