Esempio n. 1
0
 def test_filter_smilies(self):
     tpls = ['a {} b', '{} a b', 'a b {}']
     for smile in [':point_up_2:', ':expressionless:', ':-1:']:
         for tpl in tpls:
             self.assertEquals('a b',
                               str(TextWithoutSmilies(tpl.format(smile))))
     self.assertEquals(':hallo world:',
                       str(TextWithoutSmilies(':hallo world:')))
Esempio n. 2
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)