Esempio n. 1
0
def sanitize_project(project):
  if project.description:
    project.description = sanitize.sanitize_html(project.description)
  if project.url:
    project.url = sanitize.sanitize_url(project.url)
  if project.info_url:
    project.info_url = sanitize.sanitize_url(project.info_url)
  if project.src_url:
    project.src_url = sanitize.sanitize_url(project.src_url)
  # Thumbnail URLs should always point back to our server.
  if project.thumbnail_url and not project.thumbnail_url.startswith("/"):
    project.thumbnail_url = None
def sanitize_url_and_assert(expected_url, given_url):
  assert_equals(expected_url, sanitize.sanitize_url(given_url))