Beispiel #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)
Beispiel #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)
Beispiel #3
0
 def test_unicodedata(self):
     """Remove emoji if unicodedata2 is not installed"""
     with import_unicodedata():
         assert convert_emoji(u'Example \U0001f62a') == 'Example '
Beispiel #4
0
 def test_sleepy_face(self):
     """Replace emoji with name if unicodedata2 is installed"""
     assert convert_emoji(u'Example \U0001f62a') == 'Example SLEEPY FACE'
Beispiel #5
0
 def test_no_emoji(self):
     assert convert_emoji(u'Example example') == 'Example example'