Code

make some more memorydb tests pass
[roundup.git] / roundup / roundupdb.py
index 570c767e49e0bd7bc6a00ac18dfb98876f68cce8..5ba6b4512e03952a1b458f36b03053a01392dafc 100644 (file)
@@ -35,7 +35,8 @@ from roundup import password, date, hyperdb
 from roundup.i18n import _
 
 # MessageSendError is imported for backwards compatibility
-from roundup.mailer import Mailer, MessageSendError, encode_quopri
+from roundup.mailer import Mailer, MessageSendError, encode_quopri, \
+    nice_sender_header
 
 class Database:
 
@@ -237,7 +238,7 @@ class IssueClass:
             """ Make sure we don't send mail to either the anonymous
                 user or a user who has already seen the message.
                 Also check permissions on the message if not a system
-                message: A user must have view permisson on content and
+                message: A user must have view permission on content and
                 files to be on the receiver list. We do *not* check the 
                 author etc. for now.
             """
@@ -360,8 +361,7 @@ class IssueClass:
         if msgid :
             for fileid in messages.get(msgid, 'files') :
                 # check the attachment size
-                filename = self.db.filename('file', fileid, None)
-                filesize = os.path.getsize(filename)
+                filesize = self.db.filesize('file', fileid, None)
                 if filesize <= self.db.config.NOSY_MAX_ATTACHMENT_SIZE:
                     message_files.append(fileid)
                 else:
@@ -406,9 +406,10 @@ class IssueClass:
         else:
             sendto = [sendto]
 
+        # tracker sender info
         tracker_name = unicode(self.db.config.TRACKER_NAME, 'utf-8')
-        tracker_name = formataddr((tracker_name, from_address))
-        tracker_name = Header(tracker_name, charset)
+        tracker_name = nice_sender_header(tracker_name, from_address,
+            charset)
 
         # now send one or more messages
         # TODO: I believe we have to create a new message each time as we