Esempio n. 1
0
 def prepare(self, force=0):
     if self.delay:
         reply_header = self.reply_header(force)
         if reply_header:
             if not dry:
                 self.file = os.popen('sendmail -i -t', 'w')
             else:
                 self.file = sys.stdout
             self.file.write(messages.translate(reply_header, self.lang))
             for line in self.delayed:
                 try:
                     self.file.write(messages.translate(line, self.lang,
                                                        self.encoding))
                 except UnicodeEncodeError:
                     # XXX Chapuza, to finally get to see what goes wrong.
                     self.file.write(self.prune_hibit(line))
             self.delay = 0
             self.delayed = []
Esempio n. 2
0
 def write_nofill(self, text):
     if self.delay:
         self.delayed.append('\n')
         self.delayed.append(text)
         self.delayed.append('\n')
     else:
         self.file.write('\n')
         try:
             self.file.write(messages.translate(text, self.lang,
                                                self.encoding))
         except UnicodeEncodeError:
             self.file.write(self.prune_hibit(text))
         self.file.write('\n')