You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I forgot the key in a view's dynamic context. The resulting errors:
2020-05-26 08:35:14,078 statik.project ERROR Error: Failed to build project. Run Statik in verbose mode (-v) to see additional traceback inform
ation about this error. (in file personal-site\views\blog.yml"). Additional error detail: 'str' object has no attr
ibute 'items'
Verbose mode:
2020-05-26 08:37:31,096 statik.project DEBUG Traceback (most recent call last):
File "personal-site\.venv\lib\site-packages\statik\project.py", line 121, in generate
self.views = self.load_views()
File "personal-site\.venv\lib\site-packages\statik\project.py", line 209, in load_views
views[view_name] = StatikView(
File "personal-site\.venv\lib\site-packages\statik\views.py", line 340, in __init__
self.context = StatikContext(
File "personal-site\.venv\lib\site-packages\statik\context.py", line 29, in __init__
self.dynamic = underscore_var_names(
File "personal-site\.venv\lib\site-packages\statik\utils.py", line 120, in underscore_var_names
for k, v in d.items():
AttributeError: 'str' object has no attribute 'items'
2020-05-26 08:37:31,096 statik.project ERROR Error: Failed to build project. Run Statik in verbose mode (-v) to see additional traceback inform
ation about this error. (in file "C:\Users\pathu\src\pathunstrom\personal-site\views\blog.yml"). Additional error detail: 'str' object has no attr
ibute 'items'
Looking at the code, StatikContext knows it's looking for dynamic context as a dict, so wrapping the call to underscore_var_names in a try: except AttributeError should make it possible to give the user a clear explanation of where and what was wrong.
This is only the case if your context is a single item and you forgot the key. If you have multiple items and forget one key, the yaml scanner yells at you about the misformed YAML.
I'd be looking for a message along the lines of "{dynamic|static} context for {file_name} must be a mapping."
The text was updated successfully, but these errors were encountered:
I forgot the key in a view's dynamic context. The resulting errors:
Verbose mode:
Looking at the code, StatikContext knows it's looking for dynamic context as a dict, so wrapping the call to underscore_var_names in a try: except AttributeError should make it possible to give the user a clear explanation of where and what was wrong.
This is only the case if your context is a single item and you forgot the key. If you have multiple items and forget one key, the yaml scanner yells at you about the misformed YAML.
I'd be looking for a message along the lines of "{dynamic|static} context for {file_name} must be a mapping."
The text was updated successfully, but these errors were encountered: