Products.ContentTypeValidator

Provides a archetypes field validator for content types of files


License
GPL-2.0+
Install
pip install Products.ContentTypeValidator==2.0b4

Documentation

Introduction

Provides an archetypes validator for file and image fields to only allow specific content types to be added.

Example

from Products.ContentTypeValidator.validator import ContentTypeValidator

  ...

FileField('file',
    validators = (ContentTypeValidator(('audio/mpeg', 'audio/x-mp3', 'audio/x-mpeg', 'audio/mp3',))),
    widget = atapi.FileWidget(
        description = '',
        label=_(u'label_audio', default=u'Audio file'),
        show_content_type = False,),
),

  ...