Exemple #1
0
 def checkEntries(self):
     errors = []
     if not self.cellFeed.value in rssFeeds and not isValidAbsolute(
             self.cellFeed.value):
         errors.append(_("RSS feed field contents invalid"))
     try:
         if self.cellMatchText.value:
             re.compile(self.cellMatchText.value)
     except Exception as err:
         errors.append(_("Match text field contents error {0}").format(err))
     if self.cellFormulaFile.value and not os.path.exists(
             self.cellFormulaFile.value):
         errors.append(
             _("Formula file not found {0}").format(
                 self.cellFormulaFile.value))
     if self.cellLogFile.value and not os.path.exists(
             os.path.dirname(self.cellLogFile.value)):
         errors.append(
             _("Log file directory not found {0}").format(
                 self.cellLogFile.value))
     if self.cellEmailAddress.value:
         if not emailPattern.match(self.cellEmailAddress.value):
             errors.append(
                 _("E-mail address format error").format(
                     self.cellLogFile.value))
     if self.cellLatestPubDate.value and datetime(
             self.cellLatestPubDate.value) is None:
         errors.append(_("Latest pub date field contents invalid"))
     if errors:
         tkinter.messagebox.showwarning(_("Dialog validation error(s)"),
                                        "\n ".join(errors),
                                        parent=self.parent)
         return False
     return True
Exemple #2
0
 def checkEntries(self):
     errors = []
     if not self.cellFeed.value in rssFeeds and not isValidAbsolute(self.cellFeed.value):
         errors.append(_("RSS feed field contents invalid"))
     try:
         if self.cellMatchText.value:
             re.compile(self.cellMatchText.value)
     except Exception as err:
         errors.append(_("Match text field contents error {0}").format(err))
     if self.cellFormulaFile.value and not os.path.exists(self.cellFormulaFile.value):
         errors.append(_("Formula file not found {0}").format(self.cellFormulaFile.value))
     if self.cellLogFile.value and not os.path.exists(os.path.dirname(self.cellLogFile.value)):
         errors.append(_("Log file directory not found {0}").format(self.cellLogFile.value))
     if self.cellEmailAddress.value:
         if not emailPattern.match(self.cellEmailAddress.value):
             errors.append(_("E-mail address format error").format(self.cellLogFile.value))
         if not self.options.get("smtpEmailSettings"):
             errors.append(_("Please enter E-mail server settings (SMTP)"))
     if self.cellLatestPubDate.value and dateTime(self.cellLatestPubDate.value) is None:
         errors.append(_("Latest pub date field contents invalid"))
     if errors:
         messagebox.showwarning(_("Dialog validation error(s)"),
                             "\n ".join(errors), parent=self)
         return False
     return True