diff --git a/tools/lint-all b/tools/lint-all index a41ef6ab8c9e8..f420648a02ab9 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -193,7 +193,7 @@ python_rules = [ 'return json_error(data=error_data, msg=ret_error)'), ('zerver/views/streams.py', 'return json_error(property_conversion)'), # We can't do anything about this. - ('zerver/views/realm_emoji.py', 'return json_error(e.message_dict)'), + ('zerver/views/realm_emoji.py', 'return json_error(e.messages[0])'), ]), 'description': 'Argument to json_error should a literal string enclosed by _()'}, # To avoid JsonableError(_variable) and JsonableError(_(variable)) diff --git a/zerver/models.py b/zerver/models.py index c8167b0000553..9703ac6cdcd25 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -25,6 +25,7 @@ from zerver.lib.timestamp import datetime_to_timestamp from django.db.models.signals import pre_save, post_save, post_delete from django.core.validators import MinLengthValidator, RegexValidator +from django.utils.translation import ugettext as _ import zlib from bitfield import BitField @@ -243,7 +244,8 @@ class RealmEmoji(models.Model): realm = models.ForeignKey(Realm) # Second part of the regex (negative lookbehind) disallows names ending with one of the punctuation characters name = models.TextField(validators=[MinLengthValidator(1), - RegexValidator(regex=r'^[0-9a-zA-Z.\-_]+(?