def __init__(self, orderMethod, responseMethod, show='view', page='main', group=None, layouts=None, move=0, specificReadPermission=False, specificWritePermission=False, width=None, height=None, colspan=1, master=None, masterValue=None, focus=False, mapping=None, label=None): Type.__init__(self, None, (0,1), None, show, page, group, layouts, move, False, False,specificReadPermission, specificWritePermission, width, height, None, colspan, master, masterValue, focus, False, True, mapping, label, None) # orderMethod must contain a method returning a dict containing info # about the order. Following keys are mandatory: # * orderID An identifier for the order. Don't use the object UID # for this, use a random number, because if the payment # is canceled, Ogone will not allow you to reuse the same # orderID for the next tentative. # * amount An integer representing the price for this order, # multiplied by 100 (no floating point value, no commas # are tolerated. Dont't forget to multiply the amount by # 100! self.orderMethod = orderMethod # responseMethod must contain a method accepting one param, let's call # it "response". The response method will be called when we will get # Ogone's response about the status of the payment. Param "response" is # an object whose attributes correspond to all parameters that you have # chosen to receive in your Ogone merchant account. After the payment, # the user will be redirected to the object's view page, excepted if # your method returns an alternatve URL. self.responseMethod = responseMethod
def __init__(self, orderMethod, responseMethod, show='view', page='main', group=None, layouts=None, move=0, specificReadPermission=False, specificWritePermission=False, width=None, height=None, colspan=1, master=None, masterValue=None, focus=False, mapping=None, label=None): Type.__init__(self, None, (0,1), None, None, False, False, show, page, group, layouts, move, False, False,specificReadPermission, specificWritePermission, width, height, None, colspan, master, masterValue, focus, False, True, mapping, label) # orderMethod must contain a method returning a dict containing info # about the order. Following keys are mandatory: # * orderID An identifier for the order. Don't use the object UID # for this, use a random number, because if the payment # is canceled, Ogone will not allow you to reuse the same # orderID for the next tentative. # * amount An integer representing the price for this order, # multiplied by 100 (no floating point value, no commas # are tolerated. Dont't forget to multiply the amount by # 100! self.orderMethod = orderMethod # responseMethod must contain a method accepting one param, let's call # it "response". The response method will be called when we will get # Ogone's response about the status of the payment. Param "response" is # an object whose attributes correspond to all parameters that you have # chosen to receive in your Ogone merchant account. After the payment, # the user will be redirected to the object's view page, excepted if # your method returns an alternatve URL. self.responseMethod = responseMethod
def __init__(self, eventTypes, eventNameMethod=None, validator=None, default=None, show='view', page='main', group=None, layouts=None, move=0, specificReadPermission=False, specificWritePermission=False, width=None, height=300, colspan=1, master=None, masterValue=None, focus=False, mapping=None, label=None, maxEventLength=50, otherCalendars=None, additionalInfo=None, startDate=None, endDate=None, defaultDate=None, preCompute=None, applicableEvents=None): Type.__init__(self, validator, (0,1), default, show, page, group, layouts, move, False, False, specificReadPermission, specificWritePermission, width, height, None, colspan, master, masterValue, focus, False, True, mapping, label, None) # eventTypes can be a "static" list or tuple of strings that identify # the types of events that are supported by this calendar. It can also # be a method that computes such a "dynamic" list or tuple. When # specifying a static list, an i18n label will be generated for every # event type of the list. When specifying a dynamic list, you must also # give, in p_eventNameMethod, a method that will accept a single arg # (=one of the event types from your dynamic list) and return the "name" # of this event as it must be shown to the user. self.eventTypes = eventTypes self.eventNameMethod = eventNameMethod if (type(eventTypes) == types.FunctionType) and not eventNameMethod: raise Exception("When param 'eventTypes' is a method, you must " \ "give another method in param 'eventNameMethod'.") # It is not possible to create events that span more days than # maxEventLength. self.maxEventLength = maxEventLength # When displaying a given month for this agenda, one may want to # pre-compute, once for the whole month, some information that will then # be given as arg for other methods specified in subsequent parameters. # This mechanism exists for performance reasons, to avoid recomputing # this global information several times. If you specify a method in # p_preCompute, it will be called every time a given month is shown, and # will receive 2 args: the first day of the currently shown month (as a # DateTime instance) and the grid of all shown dates (as a list of lists # of DateTime instances, one sub-list by row in the month view). This # grid may hold a little more than dates of the current month. # Subsequently, the return of your method will be given as arg to other # methods that you may specify as args of other parameters of this # Calendar class (see comments below). self.preCompute = preCompute # If a method is specified in the following parameters, it must accept # a single arg (the result of self.preCompute) and must return a list of # calendars whose events must be shown within this agenda. # Every element in this list must be a sub-list [object, name, color] # (not a tuple): # - object must refer to the other object on which the other calendar # field is defined; # - name is the name of the field on this object that stores the # calendar; # - color must be a string containing the HTML color (including the # leading "#" when relevant) into which events of the calendar must # appear. self.otherCalendars = otherCalendars # One may want to add, day by day, custom information in the calendar. # When a method is given in p_additionalInfo, for every cell of the # month view, this method will be called with 2 args: the cell's date # and the result of self.preCompute. The method's result (a string that # can hold text or a chunk of XHTML) will be inserted in the cell. self.additionalInfo = additionalInfo # One may limit event encoding and viewing to a limited period of time, # via p_startDate and p_endDate. Those parameters, if given, must hold # methods accepting no arg and returning a Zope DateTime instance. self.startDate = startDate # Beware: specify an end date with an hour like # DateTime('2012/10/13 23:59:59') to avoid surprises. self.endDate = endDate # If a default date is specified, it must be a method accepting no arg # and returning a DateTime instance. As soon as the calendar is shown, # the month where this date is included will be shown. If not default # date is specified, it will be 'now' at the moment the calendar is # shown. self.defaultDate = defaultDate # For a specific day, all event types may not be applicable. If this is # the case, one may specify here a method that defines, for a given day, # a sub-set of all event types. This method must accept 3 args: the day # in question (as a DateTime instance), the list of all event types, # which is a copy of the (possibly computed) self.eventTypes) and # the result of calling self.preCompute. The method must modify # the 2nd arg and remove from it potentially not applicable events. # This method can also return a message, that will be shown to the user # for explaining him why he can, for this day, only create events of a # sub-set of the possible event types (or even no event at all). self.applicableEvents = applicableEvents
def __init__(self, eventTypes, eventNameMethod=None, validator=None, default=None, show='view', page='main', group=None, layouts=None, move=0, specificReadPermission=False, specificWritePermission=False, width=None, height=300, colspan=1, master=None, masterValue=None, focus=False, mapping=None, label=None, maxEventLength=50, otherCalendars=None, additionalInfo=None, startDate=None, endDate=None, defaultDate=None, preCompute=None, applicableEvents=None): Type.__init__(self, validator, (0, 1), default, show, page, group, layouts, move, False, False, specificReadPermission, specificWritePermission, width, height, None, colspan, master, masterValue, focus, False, True, mapping, label, None, None, None, None) # eventTypes can be a "static" list or tuple of strings that identify # the types of events that are supported by this calendar. It can also # be a method that computes such a "dynamic" list or tuple. When # specifying a static list, an i18n label will be generated for every # event type of the list. When specifying a dynamic list, you must also # give, in p_eventNameMethod, a method that will accept a single arg # (=one of the event types from your dynamic list) and return the "name" # of this event as it must be shown to the user. self.eventTypes = eventTypes self.eventNameMethod = eventNameMethod if (type(eventTypes) == types.FunctionType) and not eventNameMethod: raise Exception("When param 'eventTypes' is a method, you must " \ "give another method in param 'eventNameMethod'.") # It is not possible to create events that span more days than # maxEventLength. self.maxEventLength = maxEventLength # When displaying a given month for this agenda, one may want to # pre-compute, once for the whole month, some information that will then # be given as arg for other methods specified in subsequent parameters. # This mechanism exists for performance reasons, to avoid recomputing # this global information several times. If you specify a method in # p_preCompute, it will be called every time a given month is shown, and # will receive 2 args: the first day of the currently shown month (as a # DateTime instance) and the grid of all shown dates (as a list of lists # of DateTime instances, one sub-list by row in the month view). This # grid may hold a little more than dates of the current month. # Subsequently, the return of your method will be given as arg to other # methods that you may specify as args of other parameters of this # Calendar class (see comments below). self.preCompute = preCompute # If a method is specified in the following parameters, it must accept # a single arg (the result of self.preCompute) and must return a list of # calendars whose events must be shown within this agenda. # Every element in this list must be a sub-list [object, name, color] # (not a tuple): # - object must refer to the other object on which the other calendar # field is defined; # - name is the name of the field on this object that stores the # calendar; # - color must be a string containing the HTML color (including the # leading "#" when relevant) into which events of the calendar must # appear. self.otherCalendars = otherCalendars # One may want to add, day by day, custom information in the calendar. # When a method is given in p_additionalInfo, for every cell of the # month view, this method will be called with 2 args: the cell's date # and the result of self.preCompute. The method's result (a string that # can hold text or a chunk of XHTML) will be inserted in the cell. self.additionalInfo = additionalInfo # One may limit event encoding and viewing to a limited period of time, # via p_startDate and p_endDate. Those parameters, if given, must hold # methods accepting no arg and returning a Zope DateTime instance. self.startDate = startDate # Beware: specify an end date with an hour like # DateTime('2012/10/13 23:59:59') to avoid surprises. self.endDate = endDate # If a default date is specified, it must be a method accepting no arg # and returning a DateTime instance. As soon as the calendar is shown, # the month where this date is included will be shown. If not default # date is specified, it will be 'now' at the moment the calendar is # shown. self.defaultDate = defaultDate # For a specific day, all event types may not be applicable. If this is # the case, one may specify here a method that defines, for a given day, # a sub-set of all event types. This method must accept 3 args: the day # in question (as a DateTime instance), the list of all event types, # which is a copy of the (possibly computed) self.eventTypes) and # the result of calling self.preCompute. The method must modify # the 2nd arg and remove from it potentially not applicable events. # This method can also return a message, that will be shown to the user # for explaining him why he can, for this day, only create events of a # sub-set of the possible event types (or even no event at all). self.applicableEvents = applicableEvents