Source code for pyams_sequence.schema

#
# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#

__docformat__ = 'restructuredtext'


# import standard library

# import interfaces
from zope.schema.interfaces import ITextLine, IList

# import packages
from zope.interface import implementer, Attribute
from zope.schema import TextLine, List


[docs]class IInternalReferenceField(ITextLine): """Internal reference field interface""" content_type = Attribute("Requested target content type")
[docs]@implementer(IInternalReferenceField) class InternalReferenceField(TextLine): """Internal reference field""" def __init__(self, content_type=None, *args, **kwargs): super(InternalReferenceField, self).__init__(*args, **kwargs) self.content_type = content_type
[docs]class IInternalReferencesListField(IList): """Internal references list field interface""" content_type = Attribute("Requested target content type")
[docs]@implementer(IInternalReferencesListField) class InternalReferencesListField(List): """Internal references list field""" def __init__(self, content_type=None, value_type=None, unique=False, *args, **kwargs): super(InternalReferencesListField, self).__init__(value_type=TextLine(), unique=True, *args, **kwargs) self.content_type = content_type