From 20259a4414ddc7dcb852276e46c0d1c0a3a2e537 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 25 Aug 2013 22:31:37 -0400 Subject: [PATCH] Remove some references to the Toolserver. --- build.py | 5 ----- toolserver/background.py | 4 ++-- toolserver/cookies.py | 2 +- toolserver/misc.py | 4 +++- toolserver/preconfig.py.ts | 32 -------------------------------- toolserver/settings.py | 6 +++--- 6 files changed, 9 insertions(+), 44 deletions(-) delete mode 100644 toolserver/preconfig.py.ts diff --git a/build.py b/build.py index cb427a6..23b1e0b 100755 --- a/build.py +++ b/build.py @@ -14,11 +14,6 @@ import sys os.chdir("..") sys.path.insert(0, ".") -try: - from toolserver import preconfig -except ImportError: - pass - from mako.template import Template from mako.lookup import TemplateLookup diff --git a/toolserver/background.py b/toolserver/background.py index 9ab8efa..704c626 100644 --- a/toolserver/background.py +++ b/toolserver/background.py @@ -15,8 +15,8 @@ _descurl = None def set_background(context, cookies, selected): global _descurl conn = open_sql_connection(get_bot(), "globals") - if "EarwigScreenCache" in cookies: - cache = cookies["EarwigScreenCache"].value + if "CopyviosScreenCache" in cookies: + cache = cookies["CopyviosScreenCache"].value try: screen = loads(cache) int(screen["width"]) diff --git a/toolserver/cookies.py b/toolserver/cookies.py index 1a86cc7..659d130 100644 --- a/toolserver/cookies.py +++ b/toolserver/cookies.py @@ -6,7 +6,7 @@ from datetime import datetime, timedelta from os import path class _CookieManager(SimpleCookie): - MAGIC = "--ets1" + MAGIC = "--cpv2" def __init__(self, environ): self._path = path.split(environ["PATH_INFO"])[0] diff --git a/toolserver/misc.py b/toolserver/misc.py index b115131..f554f7a 100644 --- a/toolserver/misc.py +++ b/toolserver/misc.py @@ -47,9 +47,11 @@ def get_bot(): def open_sql_connection(bot, dbname): if dbname in _connections: return _connections[dbname] - conn_args = bot.config.wiki["_toolserverSQL"][dbname] + conn_args = bot.config.wiki["_copyviosSQL"][dbname] if "read_default_file" not in conn_args and "user" not in conn_args and "passwd" not in conn_args: conn_args["read_default_file"] = expanduser("~/.my.cnf") + elif "read_default_file" in args: + args["read_default_file"] = expanduser(args["read_default_file"]) if "autoping" not in conn_args: conn_args["autoping"] = True if "autoreconnect" not in conn_args: diff --git a/toolserver/preconfig.py.ts b/toolserver/preconfig.py.ts deleted file mode 100644 index f94d47b..0000000 --- a/toolserver/preconfig.py.ts +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -This module contains installation-specific import configuration for the -Toolserver. To add your own, create and put code in the file 'preconfig.py' in -this directory, or rename this file to 'preconfig.py' if you want to use this -specific configuration. -""" - -import os -import site -import sys - -# Add a local platform-specific site package directory: - -plat = sys.platform -if plat.startswith("sunos"): - plat = "solaris" -elif plat.startswith("linux"): - plat = "linux" - -site.addsitedir(os.path.expanduser("~/.local/" + plat + "/lib/python2.7/site-packages")) -sys.path.insert(0, os.path.expanduser("~/.local/" + plat + "/lib/python2.7/site-packages")) - -# EarwigBot, in-between releases, tries to import the 'git' module and add the -# current git commit ID to its __version__ string. This behavior is useful, but -# the Toolserver can be slow at importing things. Insert a fake 'git' module -# into sys.modules so it skips the __version__ addition: - -from types import ModuleType -git = ModuleType("git") -sys.modules["git"] = git diff --git a/toolserver/settings.py b/toolserver/settings.py index 6660b43..3385693 100644 --- a/toolserver/settings.py +++ b/toolserver/settings.py @@ -22,17 +22,17 @@ def main(context, environ, headers, cookies): def _do_set(query, headers, cookies): changes = set() if query.lang: - key = "EarwigDefaultLang" + key = "CopyviosDefaultLang" if key not in cookies or cookies[key].value != query.lang: set_cookie(headers, cookies, key, query.lang, 1095) changes.add("site") if query.project: - key = "EarwigDefaultProject" + key = "CopyviosDefaultProject" if key not in cookies or cookies[key].value != query.project: set_cookie(headers, cookies, key, query.project, 1095) changes.add("site") if query.background: - key = "EarwigBackground" + key = "CopyviosBackground" if key not in cookies or cookies[key].value != query.background: set_cookie(headers, cookies, key, query.background, 1095) delete_cookie(headers, cookies, "EarwigBackgroundCache")