From 992ba595b8cb14443f53ce97f371c070daf359d3 Mon Sep 17 00:00:00 2001 From: Chris Van Date: Fri, 21 Dec 2012 18:08:13 -0800 Subject: [PATCH] remove REGION_STORES setting (bug 794717) --- apps/amo/helpers.py | 2 +- apps/amo/middleware.py | 8 ++--- apps/amo/urlresolvers.py | 4 +-- apps/users/notifications.py | 4 +-- lib/settings_base.py | 3 -- mkt/account/templates/account/settings.html | 32 +++++++++---------- mkt/account/tests/test_views.py | 2 -- mkt/api/tests/test_handlers.py | 1 - mkt/browse/tests/test_views.py | 3 -- mkt/carriers/tests.py | 2 -- .../developers/apps/edit/details.html | 2 -- mkt/developers/tests/test_forms.py | 1 - mkt/developers/tests/test_tasks.py | 4 --- mkt/developers/tests/test_views.py | 2 -- mkt/developers/tests/test_views_edit.py | 26 ++------------- mkt/developers/views.py | 2 +- mkt/ecosystem/tests/test_views.py | 1 - mkt/inapp_pay/tests/test_views.py | 2 -- mkt/search/tests/test_views.py | 6 ---- mkt/settings.py | 27 ++++------------ mkt/site/tests/test_middleware.py | 19 +++-------- mkt/webapps/tests/test_models.py | 13 -------- mkt/webapps/tests/test_tasks.py | 1 - 23 files changed, 34 insertions(+), 133 deletions(-) diff --git a/apps/amo/helpers.py b/apps/amo/helpers.py index 5d81221b1e..8ba5ad6899 100644 --- a/apps/amo/helpers.py +++ b/apps/amo/helpers.py @@ -58,7 +58,7 @@ def babel_datetime(t, format='medium'): @register.function def locale_url(url): """Take a URL and give it the locale prefix.""" - if settings.MARKETPLACE and settings.REGION_STORES: + if settings.MARKETPLACE: return url prefixer = urlresolvers.get_url_prefix() script = prefixer.request.META['SCRIPT_NAME'] diff --git a/apps/amo/middleware.py b/apps/amo/middleware.py index 09b843b70d..81d44d2b26 100644 --- a/apps/amo/middleware.py +++ b/apps/amo/middleware.py @@ -244,12 +244,8 @@ class LoginRequiredMiddleware(ViewMiddleware): name.startswith(settings.NO_LOGIN_REQUIRED_MODULES)): return if settings.MARKETPLACE: - if settings.REGION_STORES: - # Redirect to /login if we're not logged in. - redirect_url = settings.LOGIN_URL - else: - # Redirect to /en-US/login if we're not logged in. - redirect_url = '/%s%s' % (request.LANG, settings.LOGIN_URL) + # Redirect to /login if we're not logged in. + redirect_url = settings.LOGIN_URL path_info = request.path_info if path_info.lstrip('/') and path_info != settings.LOGIN_URL: redirect_url = urlparams(redirect_url, to=request.path) diff --git a/apps/amo/urlresolvers.py b/apps/amo/urlresolvers.py index cc4a28f65b..9c23b2e1f7 100644 --- a/apps/amo/urlresolvers.py +++ b/apps/amo/urlresolvers.py @@ -54,7 +54,7 @@ def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None, current_app=None, add_prefix=True): """Wraps django's reverse to prepend the correct locale and app.""" prefixer = get_url_prefix() - if settings.MARKETPLACE and settings.REGION_STORES: + if settings.MARKETPLACE: prefix = None # Blank out the script prefix since we add that in prefixer.fix(). if prefixer: @@ -145,7 +145,7 @@ class Prefixer(object): def fix(self, path): # Marketplace URLs are not prefixed with `//`. - if settings.MARKETPLACE and settings.REGION_STORES: + if settings.MARKETPLACE: return path path = path.lstrip('/') diff --git a/apps/users/notifications.py b/apps/users/notifications.py index 3f99906e12..035453b7d5 100644 --- a/apps/users/notifications.py +++ b/apps/users/notifications.py @@ -160,9 +160,7 @@ NOTIFICATION_GROUPS = {'dev': _('Developer'), 'user': _('User Notifications')} APP_NOTIFICATIONS = [app_reply, app_new_review, app_reviewed, - app_individual_contact, app_surveys] -if getattr(settings, 'REGION_STORES', False): - APP_NOTIFICATIONS.append(app_regions) + app_individual_contact, app_surveys, app_regions] APP_NOTIFICATIONS_BY_ID = dict((l.id, l) for l in APP_NOTIFICATIONS) APP_NOTIFICATIONS_DEFAULT = [l.id for l in APP_NOTIFICATIONS] APP_NOTIFICATIONS_CHOICES = [(l.id, l.label) for l in APP_NOTIFICATIONS] diff --git a/lib/settings_base.py b/lib/settings_base.py index 1ee4f6ad93..736872a6fd 100644 --- a/lib/settings_base.py +++ b/lib/settings_base.py @@ -1483,9 +1483,6 @@ SOLITUDE_TIMEOUT = 10 # support it natively. SIMULATE_NAV_PAY = False -# Set this to True if you want region stores (eg: marketplace). -REGION_STORES = False - # When the dev. agreement gets updated and you need users to re-accept it # change this date. You won't want to do this for minor format changes. # The tuple is passed through to datetime.date, so please use a valid date diff --git a/mkt/account/templates/account/settings.html b/mkt/account/templates/account/settings.html index 445ffbbed0..3abfeae529 100644 --- a/mkt/account/templates/account/settings.html +++ b/mkt/account/templates/account/settings.html @@ -43,24 +43,22 @@ - {% if settings.REGION_STORES %} -
-
- -
-
- {% if DESKTOP %}
{% endif %} - - {% if DESKTOP %}
{% endif %} -
+
+
+
- {% endif %} +
+ {% if DESKTOP %}
{% endif %} + + {% if DESKTOP %}
{% endif %} +
+
{% if 'admin_log' in form.fields %}

Administration

diff --git a/mkt/account/tests/test_views.py b/mkt/account/tests/test_views.py index 5d8f3d4d44..ff1f9ce9df 100644 --- a/mkt/account/tests/test_views.py +++ b/mkt/account/tests/test_views.py @@ -221,7 +221,6 @@ class TestAccountSettings(amo.tests.TestCase): assert delete_photo_task.delay.called def test_lang_region_selector(self): - self.skip_if_disabled(settings.REGION_STORES) r = self.client.get(self.url) doc = pq(r.content) eq_(r.status_code, 200) @@ -725,7 +724,6 @@ class TestPurchases(PurchaseBase): assert '$1.00' in self.get_pq()('.purchase').eq(0).text() def test_price_locale(self): - self.skip_if_disabled(settings.REGION_STORES) purchases = self.get_pq(lang='fr') assert u'1,00' in purchases('.purchase').eq(0).text() diff --git a/mkt/api/tests/test_handlers.py b/mkt/api/tests/test_handlers.py index f322f82dee..3b926e7165 100644 --- a/mkt/api/tests/test_handlers.py +++ b/mkt/api/tests/test_handlers.py @@ -589,7 +589,6 @@ class TestCategoryHandler(BaseOAuth): eq_(data['name'], 'Webapp') def test_get_category_localised(self): - self.skip_if_disabled(settings.REGION_STORES) res = self.client.get(self.get_url, HTTP_ACCEPT_LANGUAGE='fr') data = json.loads(res.content) eq_(data['name'], 'Le Webapp') diff --git a/mkt/browse/tests/test_views.py b/mkt/browse/tests/test_views.py index 33558aba13..64d63467fe 100644 --- a/mkt/browse/tests/test_views.py +++ b/mkt/browse/tests/test_views.py @@ -41,8 +41,6 @@ class BrowseBase(amo.tests.ESTestCase): return f def setup_featured(self, num=3): - self.skip_if_disabled(settings.REGION_STORES) - # Category featured. a = amo.tests.app_factory() self.make_featured(app=a, category=self.cat) @@ -78,7 +76,6 @@ class BrowseBase(amo.tests.ESTestCase): # way, pun-wise or code-wise, please don't hesitate to do so.] In the # meantime, SkipTest is the rubber band to our elastic problems.) raise SkipTest - self.skip_if_disabled(settings.REGION_STORES) # Popular for this category. a = amo.tests.app_factory() diff --git a/mkt/carriers/tests.py b/mkt/carriers/tests.py index f10cf6514e..b7b2cb0e58 100644 --- a/mkt/carriers/tests.py +++ b/mkt/carriers/tests.py @@ -18,8 +18,6 @@ class TestCarrierURLs(TestCase): fixtures = ['base/users'] def setUp(self): - if not settings.REGION_STORES: - raise SkipTest() if not settings.USE_CARRIER_URLS: raise SkipTest() set_carrier(None) diff --git a/mkt/developers/templates/developers/apps/edit/details.html b/mkt/developers/templates/developers/apps/edit/details.html index b93680d0e7..c61071dcbc 100644 --- a/mkt/developers/templates/developers/apps/edit/details.html +++ b/mkt/developers/templates/developers/apps/edit/details.html @@ -54,7 +54,6 @@ {% endif %} - {% if settings.REGION_STORES %} {{ tip(_('Regions'), @@ -103,7 +102,6 @@ {% endif %} - {% endif %}