add services_database and remove settings_services

This commit is contained in:
Andy McKay 2011-02-15 17:13:13 -08:00
Родитель 2bcfa944d6
Коммит 6fe98bcd95
6 изменённых файлов: 28 добавлений и 37 удалений

Просмотреть файл

@ -29,7 +29,8 @@ from translations.query import order_by_translation
from users.helpers import users_list
from users.models import UserProfile
from versions.models import Version
from services import update, settings_services
from services import update
import settings_local
def norm(s):
@ -1033,11 +1034,13 @@ class TestUpdate(test_utils.TestCase):
self.mac = amo.PLATFORM_MAC
self.win = amo.PLATFORM_WIN
self.old_mirror_url = settings_services.MIRROR_URL
self.old_local_url = settings_services.LOCAL_MIRROR_URL
self.old_mirror_url = settings_local.MIRROR_URL
self.old_local_url = settings_local.LOCAL_MIRROR_URL
self.old_debug = settings_local.DEBUG
settings_services.MIRROR_URL = 'http://releases.m.o/'
settings_services.LOCAL_MIRROR_URL = 'http://addons.m.o/'
settings_local.MIRROR_URL = 'http://releases.m.o/'
settings_local.LOCAL_MIRROR_URL = 'http://addons.m.o/'
settings_local.DEBUG = False
def get(self, data):
up = update.Update(data)
@ -1045,8 +1048,9 @@ class TestUpdate(test_utils.TestCase):
return up
def tearDown(self):
settings_services.MIRROR_URL = self.old_mirror_url
settings_services.LOCAL_MIRROR_URL = self.old_local_url
settings_local.MIRROR_URL = self.old_mirror_url
settings_local.LOCAL_MIRROR_URL = self.old_local_url
settings_local.DEBUG = self.old_debug
def test_bad_guid(self):
data = self.good_data.copy()
@ -1170,14 +1174,14 @@ class TestUpdate(test_utils.TestCase):
def test_url(self):
up = self.get(self.good_data)
up.get_rdf()
assert settings_services.MIRROR_URL in up.data['row']['url']
assert settings_local.MIRROR_URL in up.data['row']['url']
def test_url_local_recent(self):
a_bit_ago = datetime.now() - timedelta(seconds=60)
File.objects.get(pk=67442).update(datestatuschanged=a_bit_ago)
up = self.get(self.good_data)
up.get_rdf()
assert settings_services.LOCAL_MIRROR_URL in up.data['row']['url']
assert settings_local.LOCAL_MIRROR_URL in up.data['row']['url']
def test_url_remote_beta(self):
file = File.objects.get(pk=67442)
@ -1194,7 +1198,7 @@ class TestUpdate(test_utils.TestCase):
self.addon_one.save()
up.get_rdf()
eq_(up.data['row']['file_id'], file.pk)
assert settings_services.MIRROR_URL in up.data['row']['url']
assert settings_local.MIRROR_URL in up.data['row']['url']
def test_hash(self):
rdf = self.get(self.good_data).get_rdf()

Просмотреть файл

@ -1,19 +0,0 @@
DATABASE_SETTINGS = {
'db': '',
'user': '',
'passwd': '',
'host': ''}
MIRROR_DELAY = 30 # Minutes before we serve downloads from mirrors.
MIRROR_URL = 'http://releases.mozilla.org/pub/mozilla.org/addons'
LOCAL_MIRROR_URL = 'https://static.addons.mozilla.net/_files'
PRIVATE_MIRROR_URL = '/_privatefiles'
DEBUG = False
SITE_URL = 'http://addons.mozilla.local:8000'
try:
from settings_services_local import *
except ImportError:
pass

Просмотреть файл

@ -5,7 +5,7 @@ from time import time
import MySQLdb as mysql
import sqlalchemy.pool as pool
import settings_services as settings
import settings_local as settings
try:
from compare import version_int
@ -111,7 +111,7 @@ class Update(object):
def get_beta(self):
data = self.data
data['status'] = STATUS_PUBLIC
if data['addon_status'] == STATUS_PUBLIC:
# Beta channel looks at the addon name to see if it's beta.
if self.is_beta_version:

Просмотреть файл

@ -1,5 +1,5 @@
from datetime import datetime, timedelta
import settings_services as settings
import settings_local as settings
import posixpath
import re
@ -46,9 +46,9 @@ ADDON_SLUGS_UPDATE = {
7: 'plugin'}
STATUSES_PUBLIC = {'STATUS_PUBLIC':'4',
'STATUS_LITE':'8',
'STATUS_LITE_AND_NOMINATED':'9'}
STATUSES_PUBLIC = {'STATUS_PUBLIC': '4',
'STATUS_LITE': '8',
'STATUS_LITE_AND_NOMINATED': '9'}
version_re = re.compile(r"""(?P<major>\d+) # major (x in x.y)

Просмотреть файл

@ -2,8 +2,7 @@ import os
import site
wsgidir = os.path.dirname(__file__)
for path in ['../', '../../vendor/lib/python', '../../apps/versions']:
for path in ['../', '../..', '../../vendor/lib/python', '../../apps/versions']:
site.addsitedir(os.path.abspath(os.path.join(wsgidir, path)))
from update import application

Просмотреть файл

@ -50,6 +50,13 @@ DATABASES = {
},
}
SERVICES_DATABASE = {
'NAME': 'zamboni',
'USER': '',
'PASSWORD': '',
'HOST': '',
}
DATABASE_ROUTERS = ('multidb.PinningMasterSlaveRouter',)
# Put the aliases for your slave databases in this list.