Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 3
0
 def test_unicodedata(self):
     """Remove emoji if unicodedata2 is not installed"""
     with import_unicodedata():
         assert convert_emoji(u'Example \U0001f62a') == 'Example '
Ejemplo 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'
Ejemplo n.º 5
0
 def test_no_emoji(self):
     assert convert_emoji(u'Example example') == 'Example example'