# HG changeset patch # User Thierry Florac # Date 1494926469 -7200 # Node ID 29fcce505afe2e6b84e962b75de97f6bd3b9c26e # Parent dd0072ed1543ae4dd3192b95ff8e152c6bf69cd5 Added schema field for internal references list diff -r dd0072ed1543 -r 29fcce505afe src/pyams_sequence/schema.py --- a/src/pyams_sequence/schema.py Tue May 16 11:20:42 2017 +0200 +++ b/src/pyams_sequence/schema.py Tue May 16 11:21:09 2017 +0200 @@ -16,17 +16,17 @@ # import standard library # import interfaces -from zope.schema.interfaces import ITextLine +from zope.schema.interfaces import ITextLine, IList # import packages from zope.interface import implementer, Attribute -from zope.schema import TextLine +from zope.schema import TextLine, List class IInternalReference(ITextLine): """Internal reference field interface""" - content_type = Attribute("Requested content type") + content_type = Attribute("Requested target content type") @implementer(IInternalReference) @@ -36,3 +36,20 @@ def __init__(self, content_type=None, *args, **kwargs): super(InternalReference, self).__init__(*args, **kwargs) self.content_type = content_type + + +class IInternalReferencesList(IList): + """Internal references list field interface""" + + content_type = Attribute("Requested target content type") + + +@implementer(IInternalReferencesList) +class InternalReferencesList(List): + """Internal references list field""" + + def __init__(self, content_type=None, value_type=None, unique=False, *args, **kwargs): + super(InternalReferencesList, self).__init__(value_type=TextLine(), + unique=True, + *args, **kwargs) + self.content_type = content_type