nephila / django-meta

Pluggable app to allow Django developers to quickly add meta tags and OpenGraph, Twitter, and Google Plus properties to their HTML responses.
https://django-meta.readthedocs.io
Other
480 stars 68 forks source link

schemaorg_description Exception #127

Closed shawnngtq closed 1 year ago

shawnngtq commented 3 years ago

Description

I noticed that there is this exception being raised but couldn't find information about it. Here is the exception log. This is shown only when the log is at DEBUG level.

2021-03-30 15:56:58,978 [DEBUG] Exception while resolving variable 'schemaorg_description' in template 'home/index.html'.
Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/myenvname/lib/python3.9/site-packages/django/template/base.py", line 829, in _resolve_lookup
    current = current[bit]
TypeError: 'Meta' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/myenvname/lib/python3.9/site-packages/django/template/base.py", line 837, in _resolve_lookup
    current = getattr(current, bit)
AttributeError: 'Meta' object has no attribute 'schemaorg_description'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/myenvname/lib/python3.9/site-packages/django/template/base.py", line 843, in _resolve_lookup
    current = current[int(bit)]
ValueError: invalid literal for int() with base 10: 'schemaorg_description'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/miniconda3/envs/myenvname/lib/python3.9/site-packages/django/template/base.py", line 848, in _resolve_lookup
    raise VariableDoesNotExist("Failed lookup for key "
django.template.base.VariableDoesNotExist: Failed lookup for key [schemaorg_description] in <meta.views.Meta object at 0x7f4beaac9280>

My settings:

META_INCLUDE_KEYWORDS = [
    ...
]
META_SITE_TYPE = 'website'
META_SITE_NAME = 'some site name'
META_USE_OG_PROPERTIES = True
META_USE_SITES = True
META_USE_SCHEMAORG_PROPERTIES = True
META_USE_TITLE_TAG = True
META_USE_TWITTER_PROPERTIES = True

Steps to reproduce

Versions

2.0.0

Expected behaviour

Actual behaviour

Additional information

python: 3.9.1 django: 3.1.6

yakky commented 2 years ago

@shawnngtq thansk for your report, and sorry for the delayed response

I can reproduce your report and apparently the schemaorg_description attribute is missing in the Meta class, thus raising the reported exception.

It should be enough to add the missing attribute in Meta class, and we hope to tackle this soon

protoroto commented 1 year ago

@shawnngtq Sorry for the late release, but we've just released a new version with a fix for this issue. Thanks for reporting :)