diff --git a/ereuse_devicehub/modules/did/templates/operator.html b/ereuse_devicehub/modules/did/templates/operator.html index 8116354c..e33a29c1 100644 --- a/ereuse_devicehub/modules/did/templates/operator.html +++ b/ereuse_devicehub/modules/did/templates/operator.html @@ -282,6 +282,65 @@ + {% if manuals.laer %} +
+
+
Recycled Content
+ +
+
+ Metal +
+
+
+ +
{{ manuals.laer.0.metal }}% +
+
+
+
+
+
+ Plastic post Consumer +
+
+
+
{{ manuals.laer.0.plastic_post_consumer }}% +
+
+
+
+
+
+ Plastic post Industry +
+
+
+
{{ manuals.laer.0.plastic_post_industry }}% +
+
+
+
+
+
+ {% endif %} + + {% if manuals.ifixit %}
diff --git a/ereuse_devicehub/modules/did/views.py b/ereuse_devicehub/modules/did/views.py index 710f5bbd..ea820186 100644 --- a/ereuse_devicehub/modules/did/views.py +++ b/ereuse_devicehub/modules/did/views.py @@ -1,4 +1,5 @@ import json +import logging import flask import requests @@ -13,6 +14,9 @@ from ereuse_devicehub import __version__ from ereuse_devicehub.modules.dpp.models import Dpp from ereuse_devicehub.resources.device.models import Device +logger = logging.getLogger(__name__) + + did = Blueprint('did', __name__, url_prefix='/did', template_folder='templates') @@ -196,16 +200,26 @@ class DidView(View): return {'data': dpps} def get_manuals(self): - params = { - "manufacturer": self.device.manufacturer, - "model": self.device.model, + manuals = { + 'ifixit': [], + 'icecat': [], + 'details': {}, + 'laer': [], } - self.params = json.dumps(params) - manuals = {'ifixit': [], 'icecat': [], 'details': {}} - manuals['ifixit'] = self.request_manuals('ifixit') - manuals['icecat'] = self.request_manuals('icecat') - if manuals['icecat']: - manuals['details'] = manuals['icecat'][0] + try: + params = { + "manufacturer": self.device.manufacturer, + "model": self.device.model, + } + self.params = json.dumps(params) + manuals['ifixit'] = self.request_manuals('ifixit') + manuals['icecat'] = self.request_manuals('icecat') + manuals['laer'] = self.request_manuals('laer') + if manuals['icecat']: + manuals['details'] = manuals['icecat'][0] + except Exception as err: + logger.error("Error: {}".format(err)) + self.context['manuals'] = manuals def request_manuals(self, prefix):