From c33b16adf54f0ba686a1000cd6d72676b067219d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 7 Jun 2011 23:01:35 +0200 Subject: [PATCH] Add minimalistic Date definition for schema editor --- themisfields/__init__.py | 2 +- themisfields/editors.py | 3 +++ themisfields/editors.zcml | 5 +++++ themisfields/handlers.py | 11 ++++++----- themisfields/handlers.zcml | 5 +++++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/themisfields/__init__.py b/themisfields/__init__.py index 232df6c..97e6e28 100644 --- a/themisfields/__init__.py +++ b/themisfields/__init__.py @@ -1,5 +1,5 @@ from zope.interface import implements -from zope.schema import Choice, Field, List +from zope.schema import Choice, Field, List, Date from zope.schema.interfaces import IFromUnicode from zope.schema.interfaces import WrongType diff --git a/themisfields/editors.py b/themisfields/editors.py index 3ad7034..0678515 100644 --- a/themisfields/editors.py +++ b/themisfields/editors.py @@ -4,6 +4,7 @@ from themisfields import interfaces from themisfields import Commission from themisfields import Author from themisfields import Authors +from themisfields import Date from plone.schemaeditor.fields import FieldFactory class ICommission(interfaces.ICommission, schema_ifaces.IFromUnicode): @@ -22,3 +23,5 @@ class IAuthors(interfaces.IAuthors, schema_ifaces.IList): pass AuthorsFactory = FieldFactory(Authors, u'Author(s)') + +DateFactory = FieldFactory(Date, u'Date') diff --git a/themisfields/editors.zcml b/themisfields/editors.zcml index 5036e8b..3aec509 100644 --- a/themisfields/editors.zcml +++ b/themisfields/editors.zcml @@ -17,4 +17,9 @@ component=".editors.AuthorsFactory" /> + + diff --git a/themisfields/handlers.py b/themisfields/handlers.py index 9e815ea..1d9da25 100644 --- a/themisfields/handlers.py +++ b/themisfields/handlers.py @@ -12,13 +12,9 @@ if HAVE_SUPERMODEL: from plone.supermodel.interfaces import IToUnicode from themisfields import Commission - from themisfields.interfaces import ICommission - from themisfields import Author - from themisfields.interfaces import IAuthor - from themisfields import Authors - from themisfields.interfaces import IAuthors + from themisfields import Date class CommissionHandler_(BaseHandler): pass @@ -34,3 +30,8 @@ if HAVE_SUPERMODEL: pass AuthorsHandler = AuthorsHandler_(Authors) + + class DateHandler_(BaseHandler): + pass + + DateHandler = DateHandler_(Date) diff --git a/themisfields/handlers.zcml b/themisfields/handlers.zcml index 32044f9..1839b69 100644 --- a/themisfields/handlers.zcml +++ b/themisfields/handlers.zcml @@ -19,4 +19,9 @@ name="themisfields.Authors" /> + +