diff --git a/fields/calendar.py b/fields/calendar.py index 821617c..86ade80 100644 --- a/fields/calendar.py +++ b/fields/calendar.py @@ -2,7 +2,7 @@ # ------------------------------------------------------------------------------ import types from appy import Object -from appy.shared.utils import splitList, IterSub +from appy.shared import utils as sutils from appy.gen import Field from appy.px import Px from DateTime import DateTime @@ -33,6 +33,22 @@ class Timeslot: if not self.eventTypes: return True return eventType in self.eventTypes +# ------------------------------------------------------------------------------ +class Validation: + '''The validation process for a calendar consists in "converting" some event + types being "wishes" to other event types being the corresponding + validated events. This class holds information about this validation + process. For more information, see the Calendar constructor, parameter + "validation".''' + def __init__(self, method, schema): + # p_method holds a method that must return True if the currently logged + # user can validate whish events. + self.method = method + # p_schema must hold a dict whose keys are the event types being wishes + # and whose values are the event types being the corresponding validated + # event types. + self.schema = schema + # ------------------------------------------------------------------------------ class Other: '''Identifies a Calendar field that must be shown within another Calendar @@ -104,9 +120,10 @@ class Calendar(Field): DateTime = DateTime # Access to Calendar utility classes via the Calendar class Timeslot = Timeslot + Validation = Validation Other = Other Event = Event - IterSub = IterSub + IterSub = sutils.IterSub # Error messages TIMESLOT_USED = 'An event is already defined at this timeslot.' DAY_FULL = 'No more place for adding this event.' @@ -155,6 +172,7 @@ class Calendar(Field): # Timeline view for a calendar pxViewTimeline = Px('''