def validate(self): if not super().validate(): return False if not utils.check_url(self.download_link.data): self.download_link.errors.append('Invalid URL') return False return True
def edit_version(self, name): args = self.parse_args() if not current_user.is_admin: restful.abort(403) if not utils.check_url(args['download_link']): restful.abort(400, message='URL is not valid') version = models.Version.query.filter_by(name=name).first_or_404() version.current_version = args['current_version'] version.download_link = args['download_link'] version.save()