VirtualMailManager/__init__.py
branchv0.6.x
changeset 234 e88ba0fb1281
parent 216 0c8c053b451c
child 253 58d1b6f41664
equal deleted inserted replaced
233:55503d63ba30 234:e88ba0fb1281
   132     Throws a `VMMError` if the local-part is too long or contains
   132     Throws a `VMMError` if the local-part is too long or contains
   133     invalid characters.
   133     invalid characters.
   134 
   134 
   135     """
   135     """
   136     if len(localpart) > 64:
   136     if len(localpart) > 64:
   137         raise VMMError(_(u'The local-part %r is too long') % localpart,
   137         raise VMMError(_(u"The local-part '%s' is too long") % localpart,
   138                        LOCALPART_TOO_LONG)
   138                        LOCALPART_TOO_LONG)
   139     invalid_chars = set(RE_LOCALPART.findall(localpart))
   139     invalid_chars = set(RE_LOCALPART.findall(localpart))
   140     if invalid_chars:
   140     if invalid_chars:
   141         i_chars = u''.join((u'"%s" ' % c for c in invalid_chars))
   141         i_chars = u''.join((u'"%s" ' % c for c in invalid_chars))
   142         raise VMMError(_(u"The local-part %(l_part)r contains invalid \
   142         raise VMMError(_(u"The local-part '%(l_part)s' contains invalid \
   143 characters: %(i_chars)s") %
   143 characters: %(i_chars)s") %
   144                        {'l_part': localpart, 'i_chars': i_chars},
   144                        {'l_part': localpart, 'i_chars': i_chars},
   145                        LOCALPART_INVALID)
   145                        LOCALPART_INVALID)
   146     return localpart
   146     return localpart
   147 
   147