--- anarkia.py (original) +++ anarkia.py (refactored) @@ -418,31 +418,31 @@ ext = {'image/jpeg': 'jpg', 'image/gif': 'gif', 'image/png': 'png'} if not formdata['name']: - raise UserError, 'Ingresa nombre.' + raise UserError('Ingresa nombre.') if not re.match(r"^[0-9a-zA-Z]+$", formdata['name']): - raise UserError, 'Nombre inválido; solo letras/números.' + raise UserError('Nombre inválido; solo letras/números.') name = ":%s:" % formdata['name'][:15] data = formdata['file'] if not data: - raise UserError, 'Ingresa imagen.' + raise UserError('Ingresa imagen.') # check if it exists already = FetchOne("SELECT 1 FROM `filters` WHERE `boards` = '%s' AND `from` = '%s'" % ( board_pickle, _mysql.escape_string(name))) if already: - raise UserError, 'Este emoji ya existe.' + raise UserError('Este emoji ya existe.') # get image information content_type, width, height, size, extra = getImageInfo(data) - if content_type not in ext.keys(): - raise UserError, 'Formato inválido. + if content_type not in ext: + raise UserError('Formato inválido.') if width > 500 or height > 500: - raise UserError, 'Dimensiones muy altas.' + raise UserError('Dimensiones muy altas.') if size > 150000: - raise UserError, 'Tamaño muy grande.' + raise UserError('Tamaño muy grande.') # create file names thumb_width, thumb_height = getThumbDimensions(width, height, 32)