Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page_attribute "field-name" page_lookup as varname fails silently #5930

Closed
jrief opened this issue Apr 13, 2017 · 4 comments
Closed

page_attribute "field-name" page_lookup as varname fails silently #5930

jrief opened this issue Apr 13, 2017 · 4 comments

Comments

@jrief
Copy link
Contributor

@jrief jrief commented Apr 13, 2017

Summary

when using the templatetag

{% page_attribute "field-name" page_lookup as varname %}

using a page_lookup of a CMS page which does not exist, this templatetag fails silently, without rendering any part of the template. This makes is very hard to track down the reason.

Expected behaviour

just as

{% page_url page_lookup as varname %}

can be used on a CMS page which does not exist, hence setting varname to None, one would expect the same behaviour for the templatetag page_attribute.

Environment

  • Python version: any
  • Django version: 1.10
  • django CMS version: 3.4.2, HEAD of releases/3.4.x
jrief added a commit to jrief/django-shop that referenced this issue Apr 13, 2017
until django-cms/django-cms#5930 is fixed, we can not use
templatetag ``{% page_attribute 'menu_title' 'shop-cart' as tooltip %}``.
Instead we must hard code the `tooltip` context variable, otherwise the cart-icon.html
fragment fails silently if the cart page does not exist.
@czpython
Copy link
Contributor

@czpython czpython commented May 22, 2017

Hello @jrief,
I'm unable to reproduce this.
Can you provide me with a test project where I can do so?
If I understand the issue correctly, when the resolver fails, it prevents the rest of the template from rendering?

@czpython
Copy link
Contributor

@czpython czpython commented May 22, 2017

/cc @nnja

@czpython
Copy link
Contributor

@czpython czpython commented Jul 17, 2017

Closing as we're unable to reproduce this.

@czpython czpython closed this Jul 17, 2017
@jrief
Copy link
Contributor Author

@jrief jrief commented Jan 25, 2019

This error occurred again, this time in version 3.5.3.
How to reproduce:

  • Create two CMS pages A and B.
  • On page A, in Advanced settings, set Page-ID to id-a.
  • To the template used by page B add:
    {% page_url 'id-a' as a_url %}
    {% page_attribute 'menu_title' 'id-a' as a_title %}
    
  • Publish both pages.
  • Remove Page-ID from page A.
  • Load Page B. If that doesn't raise a page-not-found exception, unpublish page B, then republish.

btw. there is an asymmetry in the code, while the class PageUrl implementing templatetag page_url, catches a page-not-found exception, the class PageAttribute does not catch this exception.

jrief pushed a commit to jrief/django-cms that referenced this issue Nov 26, 2020
@jrief jrief mentioned this issue Nov 26, 2020
3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants