nti.contentfragments.schema module¶
Helper classes to use content fragments in zope.interface
or zope.schema declarations.
-
class
nti.contentfragments.schema.HTMLContentFragment(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.TextUnicodeContentFragmentA
Texttype that also requires the object implement an interface descending fromIHTMLContentFragment.Pass the keyword arguments for
zope.schema.Textto the constructor; theschemaargument forObjectis already handled.Note
If you provide a default string that does not already provide
IHTMLContentFragment, one will be created simply by copying; no validation or transformation will occur.
-
class
nti.contentfragments.schema.LatexFragmentTextLine(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.TextLineUnicodeContentFragmentA
TextLinethat requires content to be in LaTeX format.Pass the keyword arguments for
TextLineto the constructor; theschemaargument forObjectis already handled.Note
If you provide a default string that does not already provide
ILatexContentFragment, one will be created simply by copying; no validation or transformation will occur.
-
class
nti.contentfragments.schema.PlainText(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.TextUnicodeContentFragmentA
zope.schema.Textthat requires content to be plain text.Pass the keyword arguments for
Textto the constructor; theschemaargument forObjectis already handled.Note
If you provide a default string that does not already provide
IPlainTextContentFragment, one will be created simply by copying; no validation or transformation will occur.Caution
This will perform conversions on the input data, stripping things that “look like” HTML, if it does not already implement the required interface.
-
class
nti.contentfragments.schema.PlainTextLine(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.TextLineUnicodeContentFragmentA
TextLinethat requires content to be plain text.Pass the keyword arguments for
TextLineto the constructor; theschemaargument forObjectis already handled.Note
If you provide a default string that does not already provide
ILatexContentFragment, one will be created simply by copying; no validation or transformation will occur.Caution
This will perform conversions on the input data, stripping things that “look like” HTML, if it does not already implement the required interface.
-
class
nti.contentfragments.schema.RstContentFragment(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.TextUnicodeContentFragmentA
zope.schema.Texttype that also requires the object implement an interface descending fromIRstContentFragment. Note that currently this does no validation of the content to ensure it is valid reStructuredText.Pass the keyword arguments for
zope.schema.Textto the constructor; theschemaargument forObjectis already handled.Note
If you provide a default string that does not already provide
IRstContentFragment, one will be created simply by copying; no validation or transformation will occur.
-
class
nti.contentfragments.schema.SanitizedHTMLContentFragment(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.HTMLContentFragmentA
Texttype that also requires the object implement an interface descending fromISanitizedHTMLContentFragment. Note that the default adapter for this can actually produceIPlainTextContentFragmentif there is no HTML present in the input.Pass the keyword arguments for
zope.schema.Textto the constructor; theschemaargument forObjectis already handled.Note
If you provide a
defaultstring that does not already provideISanitizedHTMLContentFragment, one will be created simply by copying; no validation or transformation will occur.
-
class
nti.contentfragments.schema.Tag(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.PlainTextLineRequires its content to be only one plain text word that is lowercased.
-
class
nti.contentfragments.schema.TextLineUnicodeContentFragment(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema._FromUnicodeMixin,nti.schema.field.Object,nti.schema.field.ValidTextLineA
zope.schema.TextLinetype that also requires the object implement an interface descending fromIUnicodeContentFragment.Pass the keyword arguments for
zope.schema.TextLineto the constructor; theschemaargument forObjectis already handled.If you pass neither a default nor defaultFactory argument, a defaultFactory argument will be provided to construct an empty content fragment.
Caution
This will perform conversions on the input data, stripping or adjusting things that “look like” HTML, if it does not already implement the required interface; the actual value is likely to be a
ISanitizedHTMLContentFragmentor aIPlainTextContentFragment.
-
class
nti.contentfragments.schema.TextUnicodeContentFragment(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema._FromUnicodeMixin,nti.schema.field.Object,nti.schema.field.ValidTextA
zope.schema.Texttype that also requires the object implement an interface descending fromIUnicodeContentFragment.Pass the keyword arguments for
zope.schema.Textto the constructor; theschemaargument forObjectis already handled.Caution
This will perform conversions on the input data, stripping or adjusting things that “look like” HTML, if it does not already implement the required interface; the actual value is likely to be a
ISanitizedHTMLContentFragmentor aIPlainTextContentFragment.
-
class
nti.contentfragments.schema.VerbatimPlainText(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.PlainTextLike PlainText, except instead of running a conversion on the input data, stripping HTML, will simply assume that the input data is already meant to be plain text and will preserve markup as-is.
-
class
nti.contentfragments.schema.VerbatimPlainTextLine(*args, **kwargs)[source]¶ Bases:
nti.contentfragments.schema.PlainTextLineLike PlainTextLine, except instead of running a conversion on the input data, stripping HTML, will simply assume that the input data is already meant to be plain text and will preserve markup as-is.