Exemplo n.º 1
0
    def __setattr__(self, key, value):
        if key == 'status' and self.status != value:
            value = str(Status(value))
            self.status_updated_at = datetime.now()

        if key == 'homepage':
            value = str(Url(value)) if value else None

        if key == 'description':
            value = str(TextWithoutSmilies(value[:250])) if value else None

        super().__setattr__(key, value)
Exemplo n.º 2
0
 def test_create_new_object(self):
     self.assertEquals(str(Status('promising')), 'promising')