[Spambayes-checkins] spambayes/spambayes UserInterface.py, 1.52, 1.53

Tony Meyer anadelonbrin at users.sourceforge.net
Sun Jan 2 06:01:53 CET 2005


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28819/spambayes

Modified Files:
	UserInterface.py 
Log Message:
Prepare for i18n.

cgi.escape the configuration filename, in case it contains <, > or (most likely) &

Index: UserInterface.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/UserInterface.py,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** UserInterface.py	23 Dec 2004 18:14:32 -0000	1.52
--- UserInterface.py	2 Jan 2005 05:01:50 -0000	1.53
***************
*** 89,93 ****
  from spambayes import Stats
  from spambayes import Version
! from Options import options, optionsPathname, defaults, OptionsClass
  
  IMAGES = ('helmet', 'status', 'config', 'help',
--- 89,93 ----
  from spambayes import Stats
  from spambayes import Version
! from Options import options, optionsPathname, defaults, OptionsClass, _
  
  IMAGES = ('helmet', 'status', 'config', 'help',
***************
*** 104,108 ****
      sect, opt = opt[1:].split(']', 1)
      if opt[:2].lower() == "x-" and \
!        not options.doc(sect, opt).lower().startswith("(deprecated)"):
          experimental_ini_map += ((sect, opt),)
  
--- 104,108 ----
      sect, opt = opt[1:].split(']', 1)
      if opt[:2].lower() == "x-" and \
!        not options.doc(sect, opt).lower().startswith(_("(deprecated)")):
          experimental_ini_map += ((sect, opt),)
  
***************
*** 112,116 ****
      def __init__(self, uiPort):
          Dibbler.HTTPServer.__init__(self, uiPort)
!         print 'User interface url is http://localhost:%d/' % (uiPort)
  
      def requestAuthenticationMode(self):
--- 112,116 ----
      def __init__(self, uiPort):
          Dibbler.HTTPServer.__init__(self, uiPort)
!         print _('User interface url is http://localhost:%d/') % (uiPort)
  
      def requestAuthenticationMode(self):
***************
*** 118,122 ****
  
      def getRealm(self):
!         return "SpamBayes Web Interface"
  
      def isValidUser(self, name, password):
--- 118,122 ----
  
      def getRealm(self):
!         return _("SpamBayes Web Interface")
  
      def isValidUser(self, name, password):
***************
*** 129,133 ****
  
      def getCancelMessage(self):
!         return "You must login to use SpamBayes."""
  
  
--- 129,133 ----
  
      def getCancelMessage(self):
!         return _("You must login to use SpamBayes.")
  
  
***************
*** 183,189 ****
          # *is* Home.
          html.title = name
!         if name == 'Home':
              del html.homelink
!             html.pagename = "Home"
          elif parent:
              html.pagename = "> <a href='%s'>%s</a> > %s" % \
--- 183,189 ----
          # *is* Home.
          html.title = name
!         if name == _('Home'):
              del html.homelink
!             html.pagename = _("Home")
          elif parent:
              html.pagename = "> <a href='%s'>%s</a> > %s" % \
***************
*** 283,287 ****
          results = self._buildCluesTable(message)
          results.classifyAnother = self._buildClassifyBox()
!         self._writePreamble("Classify")
          self.write(results)
          self._writePostamble()
--- 283,287 ----
          results = self._buildCluesTable(message)
          results.classifyAnother = self._buildClassifyBox()
!         self._writePreamble(_("Classify"))
          self.write(results)
          self._writePostamble()
***************
*** 325,333 ****
              probability = self.classifier.spamprob(tokens)
              cluesTable = self._fillCluesTable(clues)
!             head_name = "Tokens"
          else:
              (probability, clues) = self.classifier.spamprob(tokens, evidence=True)
              cluesTable = self._fillCluesTable(clues)
!             head_name = "Clues"
  
          results = self.html.classifyResults.clone()
--- 325,333 ----
              probability = self.classifier.spamprob(tokens)
              cluesTable = self._fillCluesTable(clues)
!             head_name = _("Tokens")
          else:
              (probability, clues) = self.classifier.spamprob(tokens, evidence=True)
              cluesTable = self._fillCluesTable(clues)
!             head_name = _("Clues")
  
          results = self.html.classifyResults.clone()
***************
*** 358,365 ****
  
                  if subject is None:
!                     heading = "Original clues: (%s)" % (len(evidence),)
                  else:
!                     heading = "Original clues for: %s (%s)" % (subject,
!                                                                len(evidence),)
                  orig_results = self._buildBox(heading, 'status.gif',
                                                cluesTable)
--- 358,365 ----
  
                  if subject is None:
!                     heading = _("Original clues: (%s)") % (len(evidence),)
                  else:
!                     heading = _("Original clues for: %s (%s)") % \
!                               (subject, len(evidence),)
                  orig_results = self._buildBox(heading, 'status.gif',
                                                cluesTable)
***************
*** 369,373 ****
          return results
  
!     def onWordquery(self, word, query_type="basic", max_results='10',
                      ignore_case=False):
          # It would be nice if the default value for max_results here
--- 369,373 ----
          return results
  
!     def onWordquery(self, word, query_type=_("basic"), max_results='10',
                      ignore_case=False):
          # It would be nice if the default value for max_results here
***************
*** 384,397 ****
          query.word.value = "%s" % (word,)
          for q_type in [query.advanced.basic,
!                                query.advanced.wildcard,
!                                query.advanced.regex]:
              if query_type == q_type.id:
                  q_type.checked = 'checked'
!                 if query_type != "basic":
                      del query.advanced.max_results.disabled
          if ignore_case:
              query.advanced.ignore_case.checked = 'checked'
          query.advanced.max_results.value = str(max_results)
!         queryBox = self._buildBox("Word query", 'query.gif', query)
          if not options["html_ui", "display_adv_find"]:
              del queryBox.advanced
--- 384,397 ----
          query.word.value = "%s" % (word,)
          for q_type in [query.advanced.basic,
!                        query.advanced.wildcard,
!                        query.advanced.regex]:
              if query_type == q_type.id:
                  q_type.checked = 'checked'
!                 if query_type != _("basic"):
                      del query.advanced.max_results.disabled
          if ignore_case:
              query.advanced.ignore_case.checked = 'checked'
          query.advanced.max_results.value = str(max_results)
!         queryBox = self._buildBox(_("Word query"), 'query.gif', query)
          if not options["html_ui", "display_adv_find"]:
              del queryBox.advanced
***************
*** 399,404 ****
          stats = []
          if word == "":
!             stats.append("You must enter a word.")
!         elif query_type == "basic" and not ignore_case:
              wordinfo = self.classifier._wordinfoget(word)
              if wordinfo:
--- 399,404 ----
          stats = []
          if word == "":
!             stats.append(_("You must enter a word."))
!         elif query_type == _("basic") and not ignore_case:
              wordinfo = self.classifier._wordinfoget(word)
              if wordinfo:
***************
*** 406,416 ****
                          self.classifier.probability(wordinfo))
              else:
!                 stat = "%r does not exist in the database." % \
                         cgi.escape(word)
              stats.append(stat)
          else:
!             if query_type != "regex":
                  word = re.escape(word)
!             if query_type == "wildcard":
                  word = word.replace("\\?", ".")
                  word = word.replace("\\*", ".*")
--- 406,416 ----
                          self.classifier.probability(wordinfo))
              else:
!                 stat = _("%r does not exist in the database.") % \
                         cgi.escape(word)
              stats.append(stat)
          else:
!             if query_type != _("regex"):
                  word = re.escape(word)
!             if query_type == _("wildcard"):
                  word = word.replace("\\?", ".")
                  word = word.replace("\\*", ".*")
***************
*** 435,452 ****
                          stats.append(stat)
              if len(stats) == 0 and max_results > 0:
!                 stat = "There are no words that begin with '%s' " \
!                         "in the database." % (word,)
                  stats.append(stat)
              elif reached_limit:
!                 if over_limit == 1:
!                     singles = ["was", "match", "is"]
!                 else:
!                     singles = ["were", "matches", "are"]
!                 stat = "There %s %d additional %s that %s not " \
!                        "shown here." % (singles[0], over_limit,
!                                         singles[1], singles[2])
                  stats.append(stat)
  
!         self._writePreamble("Word query")
          if len(stats) == 1:
              if isinstance(stat, types.TupleType):
--- 435,446 ----
                          stats.append(stat)
              if len(stats) == 0 and max_results > 0:
!                 stat = _("There are no words that begin with '%s' " \
!                          "in the database.") % (word,)
                  stats.append(stat)
              elif reached_limit:
!                 stat = _("Additional tokens not shown: %d") % (over_limit,)
                  stats.append(stat)
  
!         self._writePreamble(_("Word query"))
          if len(stats) == 1:
              if isinstance(stat, types.TupleType):
***************
*** 459,465 ****
                  stat = stats[0]
                  word = original_word
!             row = self._buildBox("Statistics for '%s'" % \
!                                  cgi.escape(word),
!                                  'status.gif', stat)
              self.write(row)
          else:
--- 453,458 ----
                  stat = stats[0]
                  word = original_word
!             row = self._buildBox(_("Statistics for '%s'") % \
!                                  cgi.escape(word), 'status.gif', stat)
              self.write(row)
          else:
***************
*** 477,484 ****
                      page.multiTable += row
                  else:
!                     self.write(self._buildBox("Statistics for '%s'" % \
                                                cgi.escape(original_word),
                                                'status.gif', stat))
!             self.write(self._buildBox("Statistics for '%s'" % \
                                        cgi.escape(original_word), 'status.gif',
                                        page))
--- 470,477 ----
                      page.multiTable += row
                  else:
!                     self.write(self._buildBox(_("Statistics for '%s'") % \
                                                cgi.escape(original_word),
                                                'status.gif', stat))
!             self.write(self._buildBox(_("Statistics for '%s'") % \
                                        cgi.escape(original_word), 'status.gif',
                                        page))
***************
*** 488,496 ****
      def onTrain(self, file, text, which):
          """Train on an uploaded or pasted message."""
!         self._writePreamble("Train")
  
          # Upload or paste?  Spam or ham?
          content = file or text
!         isSpam = (which == 'Train as Spam')
  
          # Attempt to convert the content from a DBX file to a standard mbox
--- 481,489 ----
      def onTrain(self, file, text, which):
          """Train on an uploaded or pasted message."""
!         self._writePreamble(_("Train"))
  
          # Upload or paste?  Spam or ham?
          content = file or text
!         isSpam = (which == _('Train as Spam'))
  
          # Attempt to convert the content from a DBX file to a standard mbox
***************
*** 519,523 ****
  
          # Train on the uploaded message(s).
!         self.write("<b>Training...</b>\n")
          self.flush()
          for message in messages:
--- 512,516 ----
  
          # Train on the uploaded message(s).
!         self.write("<b>" + _("Training") + "...</b>\n")
          self.flush()
          for message in messages:
***************
*** 534,538 ****
          f.close()
          self._doSave()
!         self.write("<p>OK. Return <a href='home'>Home</a> or train again:</p>")
          self.write(self._buildTrainBox())
          self._writePostamble()
--- 527,532 ----
          f.close()
          self._doSave()
!         self.write(_("%sOK. Return %sHome%s or train again:%s") %
!                    ("<p>", "<a href='home'>", "</a", "</p>"))
          self.write(self._buildTrainBox())
          self._writePostamble()
***************
*** 567,579 ****
      def _doSave(self):
          """Saves the database."""
!         self.write("<b>Saving... ")
          self.flush()
          self.classifier.store()
!         self.write("Done</b>.\n")
  
      def onSave(self, how):
          """Command handler for "Save" and "Save & shutdown"."""
          isShutdown = how.lower().find('shutdown') >= 0
!         self._writePreamble("Save", showImage=(not isShutdown))
          self._doSave()
          if isShutdown:
--- 561,573 ----
      def _doSave(self):
          """Saves the database."""
!         self.write("<b>" + _("Saving..."))
          self.flush()
          self.classifier.store()
!         self.write(_("Done.") + "</b>\n")
  
      def onSave(self, how):
          """Command handler for "Save" and "Save & shutdown"."""
          isShutdown = how.lower().find('shutdown') >= 0
!         self._writePreamble(_("Save"), showImage=(not isShutdown))
          self._doSave()
          if isShutdown:
***************
*** 596,600 ****
          del form.submit_ham
          form.action = "classify"
!         return self._buildBox("Classify a message", 'classify.gif', form)
  
      def _buildTrainBox(self):
--- 590,594 ----
          del form.submit_ham
          form.action = "classify"
!         return self._buildBox(_("Classify a message"), 'classify.gif', form)
  
      def _buildTrainBox(self):
***************
*** 605,609 ****
          form = self.html.upload.clone()
          del form.submit_classify
!         return self._buildBox("Train on a message, mbox file or dbx file",
                                'message.gif', form)
  
--- 599,603 ----
          form = self.html.upload.clone()
          del form.submit_classify
!         return self._buildBox(_("Train on a message, mbox file or dbx file"),
                                'message.gif', form)
  
***************
*** 615,624 ****
      def onExperimentalconfig(self):
          html = self._buildConfigPage(experimental_ini_map)
!         html.title = 'Home &gt; Experimental Configuration'
!         html.pagename = '&gt; Experimental Configuration'
!         html.adv_button.name.value = "Back to basic configuration"
          html.adv_button.action = "config"
!         html.config_submit.value = "Save experimental options"
!         html.restore.value = "Restore experimental options defaults (all off)"
          del html.exp_button
          self.writeOKHeaders('text/html')
--- 609,618 ----
      def onExperimentalconfig(self):
          html = self._buildConfigPage(experimental_ini_map)
!         html.title = _('Home &gt; Experimental Configuration')
!         html.pagename = _('&gt; Experimental Configuration')
!         html.adv_button.name.value = _("Back to basic configuration")
          html.adv_button.action = "config"
!         html.config_submit.value = _("Save experimental options")
!         html.restore.value = _("Restore experimental options defaults (all off)")
          del html.exp_button
          self.writeOKHeaders('text/html')
***************
*** 627,636 ****
      def onAdvancedconfig(self):
          html = self._buildConfigPage(self.advanced_options_map)
!         html.title = 'Home &gt; Advanced Configuration'
!         html.pagename = '&gt; Advanced Configuration'
!         html.adv_button.name.value = "Back to basic configuration"
          html.adv_button.action = "config"
!         html.config_submit.value = "Save advanced options"
!         html.restore.value = "Restore advanced options defaults"
          del html.exp_button
          self.writeOKHeaders('text/html')
--- 621,630 ----
      def onAdvancedconfig(self):
          html = self._buildConfigPage(self.advanced_options_map)
!         html.title = _('Home &gt; Advanced Configuration')
!         html.pagename = _('&gt; Advanced Configuration')
!         html.adv_button.name.value = _("Back to basic configuration")
          html.adv_button.action = "config"
!         html.config_submit.value = _("Save advanced options")
!         html.restore.value = _("Restore advanced options defaults")
          del html.exp_button
          self.writeOKHeaders('text/html')
***************
*** 639,644 ****
      def onConfig(self):
          html = self._buildConfigPage(self.parm_ini_map)
!         html.title = 'Home &gt; Configure'
!         html.pagename = '&gt; Configure'
          self.writeOKHeaders('text/html')
          self.write(html)
--- 633,638 ----
      def onConfig(self):
          html = self._buildConfigPage(self.parm_ini_map)
!         html.title = _('Home &gt; Configure')
!         html.pagename = _('&gt; Configure')
          self.writeOKHeaders('text/html')
          self.write(html)
***************
*** 652,656 ****
          html.mainContent = self.html.configForm.clone()
          html.mainContent.configFormContent = ""
!         html.mainContent.optionsPathname = optionsPathname
          return self._buildConfigPageBody(html, parm_map)
  
--- 646,650 ----
          html.mainContent = self.html.configForm.clone()
          html.mainContent.configFormContent = ""
!         html.mainContent.optionsPathname = cgi.escape(optionsPathname)
          return self._buildConfigPageBody(html, parm_map)
  
***************
*** 751,757 ****
              if options.is_boolean(sect, opt):
                  if currentValue == "False":
!                     currentValue = "No"
                  elif currentValue == "True":
!                     currentValue = "Yes"
              # XXX Something needs to be done here, otherwise really
              # XXX long options squeeze the help text too far to the
--- 745,751 ----
              if options.is_boolean(sect, opt):
                  if currentValue == "False":
!                     currentValue = _("No")
                  elif currentValue == "True":
!                     currentValue = _("Yes")
              # XXX Something needs to be done here, otherwise really
              # XXX long options squeeze the help text too far to the
***************
*** 773,779 ****
          pmap = self.parm_ini_map
          if parms.has_key("how"):
!             if parms["how"] == "Save advanced options":
                  pmap = self.advanced_options_map
!             elif parms["how"] == "Save experimental options":
                  pmap = experimental_ini_map
              del parms["how"]
--- 767,773 ----
          pmap = self.parm_ini_map
          if parms.has_key("how"):
!             if parms["how"] == _("Save advanced options"):
                  pmap = self.advanced_options_map
!             elif parms["how"] == _("Save experimental options"):
                  pmap = experimental_ini_map
              del parms["how"]
***************
*** 784,791 ****
  
          if errmsg != '':
!             html.mainContent.heading = "Errors Detected"
              html.mainContent.boxContent = errmsg
!             html.title = 'Home &gt; Error'
!             html.pagename = '&gt; Error'
              self.writeOKHeaders('text/html')
              self.write(html)
--- 778,785 ----
  
          if errmsg != '':
!             html.mainContent.heading = _("Errors Detected")
              html.mainContent.boxContent = errmsg
!             html.title = _('Home &gt; Error')
!             html.pagename = _('&gt; Error')
              self.writeOKHeaders('text/html')
              self.write(html)
***************
*** 806,821 ****
          self.reReadOptions()
  
!         html.mainContent.heading = "Options Changed"
!         html.mainContent.boxContent = "%s.  Return <a href='home'>Home</a>." \
!                                       % "Options changed"
!         html.title = 'Home &gt; Options Changed'
!         html.pagename = '&gt; Options Changed'
          self.writeOKHeaders('text/html')
          self.write(html)
  
      def onRestoredefaults(self, how):
!         if how == "Restore advanced options defaults":
              self.restoreConfigDefaults(self.advanced_options_map)
!         elif how == "Restore experimental options defaults (all off)":
              self.restoreConfigDefaults(experimental_ini_map)
          else:
--- 800,815 ----
          self.reReadOptions()
  
!         html.mainContent.heading = _("Options Changed")
!         html.mainContent.boxContent = _("Options changed.  Return " \
!                                         "<a href='home'>Home</a>.")
!         html.title = _('Home &gt; Options Changed')
!         html.pagename = _('&gt; Options Changed')
          self.writeOKHeaders('text/html')
          self.write(html)
  
      def onRestoredefaults(self, how):
!         if how == _("Restore advanced options defaults"):
              self.restoreConfigDefaults(self.advanced_options_map)
!         elif how == _("Restore experimental options defaults (all off)"):
              self.restoreConfigDefaults(experimental_ini_map)
          else:
***************
*** 826,834 ****
          html.shutdownTableCell = "&nbsp;"
          html.mainContent = self.html.headedBox.clone()
!         html.mainContent.heading = "Option Defaults Restored"
!         html.mainContent.boxContent = "%s.  Return <a href='home'>Home</a>." \
!                                       % "Defaults restored"
!         html.title = 'Home &gt; Defaults Restored'
!         html.pagename = '&gt; Defaults Restored'
          self.writeOKHeaders('text/html')
          self.write(html)
--- 820,828 ----
          html.shutdownTableCell = "&nbsp;"
          html.mainContent = self.html.headedBox.clone()
!         html.mainContent.heading = _("Option Defaults Restored")
!         html.mainContent.boxContent = _("Defaults restored.  Return " \
!                                         "<a href='home'>Home</a>.")
!         html.title = _('Home &gt; Defaults Restored')
!         html.pagename = _('&gt; Defaults Restored')
          self.writeOKHeaders('text/html')
          self.write(html)
***************
*** 866,872 ****
                  # Tim thinks that Yes/No makes more sense than True/False
                  if options.is_boolean(sect, opt):
!                     if value == "No":
                          value = False
!                     elif value == "Yes":
                          value = True
                  if options.multiple_values_allowed(sect, opt) and \
--- 860,866 ----
                  # Tim thinks that Yes/No makes more sense than True/False
                  if options.is_boolean(sect, opt):
!                     if value == _("No"):
                          value = False
!                     elif value == _("Yes"):
                          value = True
                  if options.multiple_values_allowed(sect, opt) and \
***************
*** 875,883 ****
                  value = options.convert(sect, opt, value)
              if not options.is_valid(sect, opt, value):
!                 errmsg += '<li>\'%s\' is not a value valid for [%s] %s' % \
                            (entered_value, nice_section_name,
                             options.display_name(sect, opt))
                  if type(options.valid_input(sect, opt)) == type((0,1)):
!                     errmsg += '. Valid values are: '
                      for valid in options.valid_input(sect, opt):
                          errmsg += str(valid) + ','
--- 869,877 ----
                  value = options.convert(sect, opt, value)
              if not options.is_valid(sect, opt, value):
!                 errmsg += _('<li>\'%s\' is not a value valid for [%s] %s') % \
                            (entered_value, nice_section_name,
                             options.display_name(sect, opt))
                  if type(options.valid_input(sect, opt)) == type((0,1)):
!                     errmsg += _('. Valid values are: ')
                      for valid in options.valid_input(sect, opt):
                          errmsg += str(valid) + ','
***************
*** 906,910 ****
          """Provide a help page, either the default if topic is not
          supplied, or specific to the topic given."""
!         self._writePreamble("Help")
          helppage = self.html.helppage.clone()
          if topic:
--- 900,904 ----
          """Provide a help page, either the default if topic is not
          supplied, or specific to the topic given."""
!         self._writePreamble(_("Help"))
          helppage = self.html.helppage.clone()
          if topic:
***************
*** 923,934 ****
      def onStats(self):
          """Provide statistics about previous SpamBayes activity."""
!         self._writePreamble("Statistics")
          if self.stats:
              stats = self.stats.GetStats(use_html=True)
!             stats = self._buildBox("Statistics", None,
                                     "<br/><br/>".join(stats))
          else:
!             stats = self._buildBox("Statistics", None,
!                                    "Statistics not available")
          self.write(stats)
          self._writePostamble(help_topic="stats")
--- 917,928 ----
      def onStats(self):
          """Provide statistics about previous SpamBayes activity."""
!         self._writePreamble(_("Statistics"))
          if self.stats:
              stats = self.stats.GetStats(use_html=True)
!             stats = self._buildBox(_("Statistics"), None,
                                     "<br/><br/>".join(stats))
          else:
!             stats = self._buildBox(_("Statistics"), None,
!                                    _("Statistics not available"))
          self.write(stats)
          self._writePostamble(help_topic="stats")
***************
*** 938,942 ****
          has enough information for us to help this person with their
          problem."""
!         self._writePreamble("Send Help Message", ("help", "Help"))
          report = self.html.bugreport.clone()
          # Prefill the report
--- 932,936 ----
          has enough information for us to help this person with their
          problem."""
!         self._writePreamble(_("Send Help Message"), ("help", _("Help")))
          report = self.html.bugreport.clone()
          # Prefill the report
***************
*** 1000,1010 ****
                  smtp_server = None
              if not smtp_server:
!                 self.write(self._buildBox("Warning", "status.gif",
!                            "You will be unable to send this message from " \
                             "this page, as you do not have your SMTP " \
                             "server's details entered in your configuration. " \
                             "Please either <a href='config'>enter those " \
                             "details</a>, or copy the text below into your " \
!                            "regular mail application."))
                  del report.submitrow
  
--- 994,1004 ----
                  smtp_server = None
              if not smtp_server:
!                 self.write(self._buildBox(_("Warning"), "status.gif",
!                            _("You will be unable to send this message from " \
                             "this page, as you do not have your SMTP " \
                             "server's details entered in your configuration. " \
                             "Please either <a href='config'>enter those " \
                             "details</a>, or copy the text below into your " \
!                            "regular mail application.")))
                  del report.submitrow
  
***************
*** 1025,1035 ****
  
          if not self._verifyEnteredDetails(from_addr, subject, message):
!             self._writePreamble("Error", ("help", "Help"))
!             self.write(self._buildBox("Error", "status.gif",
!                                       "You must fill in the details that " \
                                        "describe your specific problem " \
!                                       "before you can send the message."))
          else:
!             self._writePreamble("Sent", ("help", "Help"))
              mailer = smtplib.SMTP(options["smtpproxy", "remote_servers"][0])
  
--- 1019,1029 ----
  
          if not self._verifyEnteredDetails(from_addr, subject, message):
!             self._writePreamble(_("Error"), ("help", _("Help")))
!             self.write(self._buildBox(_("Error"), "status.gif",
!                                       _("You must fill in the details that " \
                                        "describe your specific problem " \
!                                       "before you can send the message.")))
          else:
!             self._writePreamble(_("Sent"), ("help", _("Help")))
              mailer = smtplib.SMTP(options["smtpproxy", "remote_servers"][0])
  
***************
*** 1097,1102 ****
                      recips.append(r)
              mailer.sendmail(from_addr, recips, outer.as_string())
!             self.write("Sent message.  Please do not send again, or " \
!                        "refresh this page!")
          self._writePostamble()
  
--- 1091,1096 ----
                      recips.append(r)
              mailer.sendmail(from_addr, recips, outer.as_string())
!             self.write(_("Sent message.  Please do not send again, or " \
!                        "refresh this page!"))
          self._writePostamble()
  
***************
*** 1104,1112 ****
          """Ensure that the user didn't just send the form message, and
          at least changed the fields."""
!         if from_addr.startswith("[YOUR EMAIL ADDRESS]"):
              return False
!         if message.endswith("[DESCRIBE YOUR PROBLEM HERE]"):
              return False
!         if subject.endswith("[PROBLEM SUMMARY]"):
              return False
          return True
--- 1098,1106 ----
          """Ensure that the user didn't just send the form message, and
          at least changed the fields."""
!         if from_addr.startswith(_("[YOUR EMAIL ADDRESS]")):
              return False
!         if message.endswith(_("[DESCRIBE YOUR PROBLEM HERE]")):
              return False
!         if subject.endswith(_("[PROBLEM SUMMARY]")):
              return False
          return True



More information about the Spambayes-checkins mailing list