Esempio n. 1
0
    def save(self, *args, **kwargs):
        # Convert emoji because emoji break MySQL
        self.description = convert_emoji(self.description)

        # Truncate the description
        self.description = self.description.strip()[:TRUNCATE_LENGTH]
        super(Response, self).save(*args, **kwargs)
Esempio n. 2
0
    def save(self, *args, **kwargs):
        # Convert emoji because emoji break MySQL
        self.description = convert_emoji(self.description)

        # Truncate the description
        self.description = self.description.strip()[:TRUNCATE_LENGTH]
        super(Response, self).save(*args, **kwargs)
Esempio n. 3
0
 def test_unicodedata(self):
     """Remove emoji if unicodedata2 is not installed"""
     with import_unicodedata():
         assert convert_emoji(u'Example \U0001f62a') == 'Example '
Esempio n. 4
0
 def test_sleepy_face(self):
     """Replace emoji with name if unicodedata2 is installed"""
     assert convert_emoji(u'Example \U0001f62a') == 'Example SLEEPY FACE'
Esempio n. 5
0
 def test_no_emoji(self):
     assert convert_emoji(u'Example example') == 'Example example'