From 2acfe625d2cb7c44743c98eb9205707c31e8f484 Mon Sep 17 00:00:00 2001 From: Mathieu Pillard Date: Thu, 1 Sep 2016 15:51:28 +0200 Subject: [PATCH] Upgrade django-product-details to the latest version --- requirements/prod.txt | 5 +++-- src/olympia/lib/product_details_backend.py | 9 ++++++++- src/olympia/lib/settings_base.py | 1 - 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/requirements/prod.txt b/requirements/prod.txt index 35b64dbe31..01fea0237e 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -106,8 +106,9 @@ django-extensions==1.6.7 \ django-filter==0.7 \ --hash=sha256:0f8fc4712f5b8da9a2d5776317d015395d58bbd94649951e35de7df2ccc69e21 \ --hash=sha256:360d6aa7c07daf95f8260db9a9dc0e04727eb4e2e45bea4f01c2b45d4722ff38 -django-mozilla-product-details==0.8.2 \ - --hash=sha256:339ddf521bb4787894aa8652a4255aafb886c37352118bd0acffa1bd6ddb1d4b +django-mozilla-product-details==0.12.1 \ + --hash=sha256:a31a51102e8c2f047f8aa62b8bdc552f7a31d9c69f2cb16393225c3ee0db72b5 \ + --hash=sha256:25ac11bd4544fef3236f32439f6b1de3bcf931f8b34c7786ab40f0ec85626eeb django-multidb-router==0.5.1 \ --hash=sha256:00b34b24d4f32077bc53ebb940e9a50edbf086917d4b2eb6a399a05890463650 django-post-request-task==0.0.3 \ diff --git a/src/olympia/lib/product_details_backend.py b/src/olympia/lib/product_details_backend.py index 4cce9519b7..37c185efdd 100644 --- a/src/olympia/lib/product_details_backend.py +++ b/src/olympia/lib/product_details_backend.py @@ -9,7 +9,14 @@ class NoCachePDFileStorage(PDFileStorage): def data(self, name): """Return the parsed JSON data of the requested file name. - Doesn't use the django-cache. + Doesn't use the django-cache, doesn't validate the name, just gets the + data from the filesystem using self.content() and store it in a dict + on the product details backend instance. + + It makes it more efficient than just using PDFileStorage with a dummy + cache backend, because we do store the result, just not in a cache + backend that needs network round-trips, and we avoid walking the + filesystem entirely. """ cache_key = self._get_cache_key(name) diff --git a/src/olympia/lib/settings_base.py b/src/olympia/lib/settings_base.py index c17efcc9a9..10e35cb02c 100644 --- a/src/olympia/lib/settings_base.py +++ b/src/olympia/lib/settings_base.py @@ -169,7 +169,6 @@ def lazy_langs(languages): # Where product details are stored see django-mozilla-product-details PROD_DETAILS_DIR = path('src', 'olympia', 'lib', 'product_json') -PROD_DETAILS_URL = 'https://svn.mozilla.org/libs/product-details/json/' PROD_DETAILS_STORAGE = 'olympia.lib.product_details_backend.NoCachePDFileStorage' # noqa # Override Django's built-in with our native names