Changeset - 3bf8898ce66d
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 15 years ago 2011-02-11 11:32:10
marcin@python-works.com
removed immutable default argument from mailer
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/smtp_mailer.py
Show inline comments
 
@@ -44,13 +44,13 @@ class SmtpMailer(object):
 
        self.user = user
 
        self.passwd = passwd
 
        self.ssl = ssl
 
        self.tls = tls
 
        self.debug = False
 

	
 
    def send(self, recipients=[], subject='', body='', attachment_files={}):
 
    def send(self, recipients=[], subject='', body='', attachment_files=None):
 

	
 
        if isinstance(recipients, basestring):
 
            recipients = [recipients]
 
        if self.ssl:
 
            smtp_serv = smtplib.SMTP_SSL(self.mail_server, self.mail_port)
 
        else:
 
@@ -127,17 +127,17 @@ class SmtpMailer(object):
 
                msg.attach(file_part)
 
        else:
 
            raise Exception('Attachment files should be'
 
                            'a dict in format {"filename":"filepath"}')
 

	
 
    def get_content(self, msg_file):
 
        '''
 
        Get content based on type, if content is a string do open first
 
        """Get content based on type, if content is a string do open first
 
        else just read because it's a probably open file object
 
        
 
        :param msg_file:
 
        '''
 
        """
 
        if isinstance(msg_file, str):
 
            return open(msg_file, "rb").read()
 
        else:
 
            #just for safe seek to 0
 
            msg_file.seek(0)
 
            return msg_file.read()
0 comments (0 inline, 0 general)