Example #1
0
  def finalizeAddElements( self, field, submittedValues ):
    '''
    This method allows the DBEditObject to have executive approval of any
    vector-vector add operation, and to take any special actions in reaction to
    the add.. if this method returns null or a success code in its ReturnVal,
    the DBField that called us is guaranteed to proceed to make the change to
    its vector.  If this method returns a non-success code in its ReturnVal,
    the DBField that called us will not make the change, and the field will be
    left unchanged.
   
    The <field> parameter identifies the field that is requesting approval for
    item deletion, and the <submittedValues> parameter carries the values to be
    added.
   
    The DBField that called us will take care of all standard checks on the
    operation (including vector bounds, etc.) before calling this method.
    Under normal circumstances, we wont need to do anything here.
    '''
    if field.getID() not in [self.MEMBERS_FIELD_ID, self.EXTERNALTARGETS_FIELD_ID]:
      return None

    if not self.fitsInNIS(submittedValues):
      return Ganymede.createErrorDialog("Overflow error", \
		"The " + str(len(submittedValues)) + \
                " items that you are attempting to add to the " + self.getTypeName() + \
		" email list cannot fit.  No NIS email list in the laboratory's " + \
		"network can be longer than 1024 characters when converted to an " + \
		"NIS email alias definition.\n\n" + \
		"If you need this list to be expanded, you should create a new sublist " + \
		"for the overflow items, move some items from this list to the new sublist, " + \
		" and then add the new sublist to this list.")

    return None