I have many custom content types with a Python Schema and it's works fine, but some of them are very similar to default content types (event, new item, page...). I want to extend the default types to add or override the fields of each default type with a Python Schema too. How can i do it?
Most of the fields of Plone default content types come from behaviors. To modify them you can make your product to override some properties.
Under the profiles/default/types add the Type.xml with the properties you want to override.
A quick example of how to make News Item folderish:
interfaces.py
# -*- coding: utf-8 -*-
from plone.app.contenttypes.interfaces import INewsItem as INewsItemOriginal
class INewsItem(INewsItemOriginal):
""" Folderish News """
Note I subclass News Item Interface to have available the views registered to the original interface
contents.py
# -*- coding: utf-8 -*-
from plone.dexterity.content import Container
from zope.interface import implementer
from .interfaces import INewsItem
@implementer(INewsItem)
class NewsItem(Container):
"""Convenience subclass for ``News Item`` portal type
"""