1. zikzakmedia
  2. trytond-electronic_mail


Raimon Esteve (Zikzakmedia)  committed cf72ee7

Revision code version 2.6

  • Participants
  • Parent commits a3dc7ea
  • Branches default

Comments (0)

Files changed (4)

File __init__.py

View file
 #This file is part electronic_mail module for Tryton.
 #The COPYRIGHT file at the top level of this repository contains 
 #the full copyright notices and license terms.
 from trytond.pool import Pool
 from electronic_mail import *

File electronic_mail.py

View file
             'mailbox', 'user', 'Write Users')
 class MailboxParent(ModelSQL):
     'Mailbox - parent - Mailbox'
     __name__ = 'electronic.mail.mailbox.mailbox'
             ondelete='CASCADE', required=True, select=1)
 class ReadUser(ModelSQL):
     'Electronic Mail - read - User'
     __name__ = 'electronic.mail.mailbox.read.res.user'
             required=True, select=1)
 class WriteUser(ModelSQL):
     'Mailbox - write - User'
     __name__ = 'electronic.mail.mailbox.write.res.user'
             required=True, select=1)
 class ElectronicMail(ModelSQL, ModelView):
     __name__ = 'electronic.mail'
     def search_mailbox_users(self, name, clause):
         return [('mailbox.' + name[8:],) + clause[1:]]
-    def _get_email(self, electronic_mail):
+    @staticmethod
+    def _get_email(electronic_mail):
         Returns the email object from reading the FS
         :param electronic_mail: Browse Record of the mail
             digest = md5.new(data).hexdigest()
         return digest
+    @classmethod
     def create_from_email(self, mail, mailbox):
         Creates a mail record from a given mail
         :param mail: email object
         :param mailbox: ID of the mailbox
-        header_obj = Pool().get('electronic.mail.header')
+        Header = Pool().get('electronic.mail.header')
         email_date = mail.get('date') and datetime.fromtimestamp(
         values = {
             'size': getsizeof(mail.as_string()),
         create_id = self.create(values)
-        header_obj.create_from_email(mail, create_id)
+        Header.create_from_email(mail, create_id)
         return create_id
-    @classmethod
-    def get_email_valid(cls, email):
+    @staticmethod
+    def get_email_valid(email):
         """Get if email is valid. @ and . characters validation
         :email: str
         return: True or False
     value = fields.Char('Value', help='Value of Header Field')
     electronic_mail = fields.Many2One('electronic.mail', 'e-mail')
+    @classmethod
     def create_from_email(self, mail, mail_id):
         :param mail: Email object

File electronic_mail.xml

File contents unchanged.

File tests/test_electronic_mail.py

File contents unchanged.