Skip to content

Commit

Permalink
added language independent field definition
Browse files Browse the repository at this point in the history
  • Loading branch information
agitator committed Dec 5, 2014
1 parent 0051d95 commit 55917b9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions plone/app/event/dx/behaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
# TODO: altern., for backwards compat., we could import from plone.z3cform
from z3c.form.browser.textlines import TextLinesFieldWidget

try:
from plone.multilingualbehavior.interfaces import ILanguageIndependentField
except ImportError:
from plone.app.multilingual.dx.interfaces import ILanguageIndependentField


def first_weekday_sun0():
return wkday_to_mon1(first_weekday())
Expand Down Expand Up @@ -147,6 +152,12 @@ def validate_start_end(data):
default=u"End date must be after start date.")
)

alsoProvides(IEventBasic['start'], ILanguageIndependentField)
alsoProvides(IEventBasic['end'], ILanguageIndependentField)
alsoProvides(IEventBasic['whole_day'], ILanguageIndependentField)
alsoProvides(IEventBasic['open_end'], ILanguageIndependentField)
alsoProvides(IEventBasic['timezone'], ILanguageIndependentField)


@adapter(getSpecification(IEventBasic['start']), IPloneFormLayer)
@implementer(IFieldWidget)
Expand Down Expand Up @@ -198,6 +209,8 @@ class IEventRecurrence(model.Schema):
default=None
)

alsoProvides(IEventRecurrence['recurrence'], ILanguageIndependentField)


@adapter(getSpecification(IEventRecurrence['recurrence']), IPloneFormLayer)
@implementer(IFieldWidget)
Expand Down Expand Up @@ -229,6 +242,8 @@ class IEventLocation(model.Schema):
default=None
)

alsoProvides(IEventLocation['location'], ILanguageIndependentField)


class IEventAttendees(model.Schema):
""" Event Attendees Schema.
Expand All @@ -249,6 +264,8 @@ class IEventAttendees(model.Schema):
)
form.widget(attendees=TextLinesFieldWidget)

alsoProvides(IEventAttendees['attendees'], ILanguageIndependentField)


class IEventContact(model.Schema):
""" Event Contact Schema.
Expand Down Expand Up @@ -306,6 +323,12 @@ class IEventContact(model.Schema):
default=None
)

alsoProvides(IEventContact['contact_name'], ILanguageIndependentField)
alsoProvides(IEventContact['contact_email'], ILanguageIndependentField)
alsoProvides(IEventContact['contact_phone'], ILanguageIndependentField)
## should the event_url be independent too?
## maybe not to allow lang specific more info links


class EventLocation(object):

Expand Down

1 comment on commit 55917b9

@thet
Copy link
Member

@thet thet commented on 55917b9 Dec 5, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there must be a fallback, if no ILanguageIndependentField is available at all...

Please sign in to comment.