def ResetDateToNormalService(self, date):
        if self._rowid is not None:
            ServicePeriodException.delete(self.cursor(),
                                          tolerant=True,
                                          service_period_rowid=self._rowid)

        if date in self.date_exceptions:
            del self.date_exceptions[date]
  def SetDateHasService(self, date, has_service=True, problems=None):
    if date in self.date_exceptions and problems:
      problems.DuplicateID(('service_id', 'date'),
                           (self.service_id, date),
                           type=problems_module.TYPE_WARNING)

    # make sure we have a rowid
    if self._rowid is None:
      self.save()

    service_period_exception = ServicePeriodException( self.service_id, date, has_service and 1 or 2 )
    service_period_exception._cursor_factory = self._cursor_factory
    service_period_exception.save(service_period_rowid = self._rowid)

    self.date_exceptions[date] = has_service and 1 or 2
    def SetDateHasService(self, date, has_service=True, problems=None):
        if date in self.date_exceptions and problems:
            problems.DuplicateID(('service_id', 'date'),
                                 (self.service_id, date),
                                 type=problems_module.TYPE_WARNING)

        # make sure we have a rowid
        if self._rowid is None:
            self.save()

        service_period_exception = ServicePeriodException(
            self.service_id, date, has_service and 1 or 2)
        service_period_exception._cursor_factory = self._cursor_factory
        service_period_exception.save(service_period_rowid=self._rowid)

        self.date_exceptions[date] = has_service and 1 or 2
  def ResetDateToNormalService(self, date):
    if self._rowid is not None:
      ServicePeriodException.delete( self.cursor(), tolerant=True, service_period_rowid=self._rowid )

    if date in self.date_exceptions:
      del self.date_exceptions[date]