A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

31 linhas
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. from .cookies import parse_cookies, set_cookie, delete_cookie
  3. from .misc import get_bot, Query
  4. from .sites import get_sites
  5. def main(context, environ, headers):
  6. cookies = parse_cookies(context, environ)
  7. query = Query(environ)
  8. if query.action == "set":
  9. if query.lang:
  10. key = "EarwigDefaultLang"
  11. if key not in cookies or cookies[key].value != query.lang:
  12. set_cookie(headers, cookies, key, query.lang, 365)
  13. if query.project:
  14. key = "EarwigDefaultProject"
  15. if key not in cookies or cookies[key].value != query.project:
  16. set_cookie(headers, cookies, key, query.project, 365)
  17. elif query.action == "delete":
  18. if query.cookie in cookies:
  19. delete_cookie(headers, cookies, query.cookie)
  20. elif query.all:
  21. for cookie in cookies.values:
  22. if cookie.path.startswith(cookies.path):
  23. delete_cookie(headers, cookies, cookie.key)
  24. bot = get_bot()
  25. langs, projects = get_sites(bot)
  26. return bot, cookies, langs, projects