Changeset 39 for branches

Show
Ignore:
Timestamp:
10/17/07 23:19:42 (1 year ago)
Author:
amcgregor
Message:

Added GUID support, and guid requirement to TurboMail.

Location:
branches/3.0
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/3.0/setup.py

    r37 r39  
    2424                license=license, 
    2525         
    26                 install_requires = ["TurboGears >= 1.0"], 
     26                install_requires = [ 
     27                        "TurboGears >= 1.0" 
     28                        "uuid >= 1.30" 
     29                ], 
    2730                extras_require = { 
    2831                        'turbogears': ["TurboGears>=1.0"] 
  • branches/3.0/turbomail/message.py

    r38 r39  
    1616from email.MIMEText import MIMEText 
    1717from email.Header import Header 
     18 
     19from uuid import uuid4 as uuid 
    1820 
    1921import logging 
     
    8991                self.tries = turbomail.config.get("mail.tries", 3) 
    9092                 
     93                self._id = None 
     94                 
    9195                for i, j in kw.iteritems(): 
    9296                        assert hasattr(self, i), "Unknown attribute: '%s'" % i 
     
    110114        bcc = property(lambda self: self._bcc, lambda self, value: self._bcc.replace(value), lambda self: self._bcc.replace()) 
    111115        disposition = property(lambda self: self._disposition, lambda self, value: self._disposition.replace(value), lambda self: self._disposition.replace()) 
     116         
     117        @property 
     118        def id(self): 
     119                if not self._id or (self._processed and self._dirty): 
     120                        self.__dict__['_id'] = str(uuid()) 
     121                 
     122                return self._id 
    112123         
    113124        @property 
     
    168179                                ('X-Mailer', "TurboMail <http://www.python-turbomail.org/>"), 
    169180                                ('X-TurboMail-Version', version), 
     181                                ('X-TurboMail-Message-GUID', self.id), 
    170182                                ('X-TurboMail-Extensions', "manager.demand v.1.0, provider.smtp v.1.0") 
    171183                        ]