A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 line
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