Exemplo n.º 1
0
 def validate_name(self, field):
     jid = generate_jid(field.data, self._date)
     if not jid:
         # This error is not very helpful to a user, but it is extremely unlikely - only if he uses a name
         # which does not contain a single char usable in a JID
         raise ValidationError(_('Could not convert name to a jabber ID'))
     if Chatroom.find_first(jid_node=jid, custom_server=self.custom_server.data):
         raise ValidationError(_('A room with this name already exists'))
     if not self.custom_server.data:
         tmp_room = Chatroom(jid_node=jid)
         if room_exists(tmp_room.jid):
             raise ValidationError(_('A room with this name/JID already exists on the Jabber server ({0})').format(
                 tmp_room.jid
             ))
Exemplo n.º 2
0
 def jid_node(self):
     return generate_jid(self.name.data, self._date)
Exemplo n.º 3
0
 def jid_node(self):
     return generate_jid(self.name.data, self._date)