jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'metaInfo'
__call__ ) -> cabc.Iterable[bytes]:
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app`, which can be
wrapped to apply middleware.
"""
return self.wsgi_app(environ, start_response)wsgi_app try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:wsgi_app ctx = self.request_context(environ)
error: BaseException | None = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]full_dispatch_request request_started.send(self, _async_wrapper=self.ensure_sync)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
self,
rv: ft.ResponseReturnValue | HTTPException,full_dispatch_request try:
request_started.send(self, _async_wrapper=self.ensure_sync)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(dispatch_request and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
view_args: dict[str, t.Any] = req.view_args # type: ignore[assignment]
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
def full_dispatch_request(self) -> Response:
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.details_page data['which_best'] = items
data['comparison_data_first_row'] = data['comparison_data'].pop(0)
data['title'] = data.get('title').title()
data['url_path'] = 'product'
data['blog_image'] = data.get('slug') if 'best-' in data.get('slug') else f'best-{data.get("slug")}'
return render_template('product.html', data=data)
if __name__ == '__main__':
app.run(debug=True, port=5001)render_template a list is given, the first name to exist will be rendered.
:param context: The variables to make available in the template.
"""
app = current_app._get_current_object() # type: ignore[attr-defined]
template = app.jinja_env.get_or_select_template(template_name_or_list)
return _render(app, template, context)
def render_template_string(source: str, **context: t.Any) -> str:
"""Render a template from the given source string with the given
context._renderdef _render(app: Flask, template: Template, context: dict[str, t.Any]) -> str:
app.update_template_context(context)
before_render_template.send(
app, _async_wrapper=app.ensure_sync, template=template, context=context
)
rv = template.render(context)
template_rendered.send(
app, _async_wrapper=app.ensure_sync, template=template, context=context
)
return rv
render ctx = self.new_context(dict(*args, **kwargs))
try:
return self.environment.concat(self.root_render_func(ctx)) # type: ignore
except Exception:
self.environment.handle_exception()
async def render_async(self, *args: t.Any, **kwargs: t.Any) -> str:
"""This works similar to :meth:`render` but returns a coroutine
that when awaited returns the entire rendered template string. This
requires the async feature to be enabled.handle_exception """Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.
"""
from .debug import rewrite_traceback_stack
raise rewrite_traceback_stack(source=source)
def join_path(self, template: str, parent: str) -> str:
"""Join a template with the parent. By default all the lookups are
relative to the loader root so this method returns the `template`
parameter unchanged, but if the paths should be relative to thetop-level template code href='https://fonts.googleapis.com/css2?family=Source+Sans+3%3Awght%40200%3B300%3B400%3B500%3B600%3B700%3B800%3B900&display=swap&ver=0.1.0'
media="none" onload="this.media='all'"/>
<meta name="taxonomy:content-type-2-page-type" content="Buying Guide"/>
<meta name="taxonomy:content-type-3-timeframe" content="Evergreen"/>
<meta name="taxonomy:content-type-4-funnel" content="Bottom Funnel"/>
<meta name="taxonomy:category" content="{{data.metaInfo.category}}"/>
<meta name="taxonomy:tags" content="{{data.metaInfo.tags}}"/>
<meta name="taxonomy:subcategory" content="{{data.metaInfo.subcategory}}"/>
<meta name="taxonomy:audience" content="{{data.metaInfo.audience}}"/>
<meta name="category:primary-category" content="Shoe Review"/>
getattr def getattr(self, obj: t.Any, attribute: str) -> t.Any:
"""Get an item or attribute of an object but prefer the attribute.
Unlike :meth:`getitem` the attribute *must* be a string.
"""
try:
return getattr(obj, attribute)
except AttributeError:
pass
try:
return obj[attribute]
except (TypeError, LookupError, AttributeError):jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'metaInfo'
This is the Copy/Paste friendly version of the traceback.
The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.