diff --git a/themis/datatypes/configure.zcml b/themis/datatypes/configure.zcml index ce7a2f5..c32e033 100644 --- a/themis/datatypes/configure.zcml +++ b/themis/datatypes/configure.zcml @@ -18,4 +18,8 @@ directory="profiles/default" provides="Products.GenericSetup.interfaces.EXTENSION" /> + + diff --git a/themis/datatypes/deputy.py b/themis/datatypes/deputy.py index 2de85e5..ad3c762 100644 --- a/themis/datatypes/deputy.py +++ b/themis/datatypes/deputy.py @@ -1,9 +1,13 @@ from five import grok from zope import schema +from zope.interface import implements +from zope.component import adapts, provideAdapter from z3c.relationfield.schema import RelationChoice from plone.formwidget.contenttree import ObjPathSourceBinder +from plone.dexterity.content import Item +from plone.app.content.interfaces import INameFromTitle from plone.directives import form, dexterity from themis.datatypes.interfaces import MessageFactory as _ @@ -19,3 +23,28 @@ class IDeputy(form.Schema): title=_(u"Political Group"), source=ObjPathSourceBinder(object_provides=IPolGroup.__identifier__), required=False) + +class INameFromPersonNames(INameFromTitle): + def title(): + '''Return a processed title''' + +class NameFromPersonNames(object): + implements(INameFromPersonNames) + + def __init__(self, context): + self.context = context + + @property + def title(self): + return self.context.firstname + ' ' + self.context.lastname + +class Deputy(Item): + implements(IDeputy) + + @property + def title(self): + return self.firstname + ' ' + self.lastname + + def setTitle(self, value): + pass + diff --git a/themis/datatypes/profiles/default/types/themis.datatypes.deputy.xml b/themis/datatypes/profiles/default/types/themis.datatypes.deputy.xml index 4a29fec..584cc43 100644 --- a/themis/datatypes/profiles/default/types/themis.datatypes.deputy.xml +++ b/themis/datatypes/profiles/default/types/themis.datatypes.deputy.xml @@ -15,13 +15,14 @@ themis.datatypes.deputy.IDeputy - plone.dexterity.content.Item + themis.datatypes.deputy.Deputy cmf.AddPortalContent +