Changeset 14012 for main/waeup.kofa


Ignore:
Timestamp:
4 Jul 2016, 05:03:17 (8 years ago)
Author:
Henrik Bettermann
Message:

Add email_sent attribute.

Add tests.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r14011 r14012  
    257257    """A school grade entry.
    258258    """
     259
    259260    subject = schema.Choice(
    260261        title = _(u'Subject'),
    261262        source = SubjectSource(),
    262263        )
     264
    263265    grade = schema.Choice(
    264266        title = _(u'Grade'),
     
    276278    """A referee entry.
    277279    """
     280    email_sent = Attribute('True if email has been sent')
     281
    278282    name = schema.TextLine(
    279283        title = _(u'Name'),
     
    281285        description = _(u'Name'),
    282286        )
     287
    283288    email = schema.ASCIILine(
    284289        title = _(u'Email Address'),
  • main/waeup.kofa/trunk/src/waeup/kofa/refereeentries.py

    r14011 r14012  
    4040    email = FieldProperty(IRefereeEntry['email'])
    4141
    42     def __init__(self, name=None, email=None):
     42    def __init__(self, name=None, email=None, email_sent=False):
    4343        super(RefereeEntry, self).__init__()
    4444        if name is not None:
     
    4646        if email is not None:
    4747            self.email = email
     48        self.email_sent = email_sent
     49        if not email_sent == True:
     50            self.email_sent = False
    4851        return
    4952
     
    6871        """A string representation that can be used in exports.
    6972
    70         Returned is a unicode string of format ``(u'<NAME>',u'<EMAIL>')``.
     73        Returned is a unicode string of format
     74        ``(u'<NAME>','<EMAIL>',<EMAILSENT>)``.
    7175        """
    72         return unicode((self.name, self.email))
     76        return unicode((self.name, self.email, self.email_sent))
    7377
    7478    @classmethod
     
    8589        i.e. use the `RefereeEntry` class, not an instance thereof.
    8690        """
    87         string = string.replace("u''", "None")
    88         name, email = eval(string)
    89         return cls(name, email)
     91        string = string.replace("u''", "None").replace("''", "None")
     92        name, email, email_sent = eval(string)
     93        return cls(name, email, email_sent)
    9094
    9195
Note: See TracChangeset for help on using the changeset viewer.