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

Use 'pageblock' instead of 'block' as django template var #103

Merged
merged 2 commits into from
Jul 21, 2015

Conversation

nikolas
Copy link
Member

@nikolas nikolas commented Jul 1, 2015

Because 'block' has the potential to conflict with django's 'block'
templatetag.

Closes github issue #29

Because 'block' has the potential to conflict with django's 'block'
templatetag.

Closes github issue #29
@nikolas nikolas force-pushed the dont-use-block-template-var branch from 9fa8006 to 09c49d8 Compare July 1, 2015 20:06
@thraxil
Copy link
Contributor

thraxil commented Jul 2, 2015

How do you propose dealing with backwards compatibility?

@nikolas
Copy link
Member Author

nikolas commented Jul 2, 2015

Thanks for pointing that out. I hadn't thought of that.

I propose that we maintain backwards compatibility by keeping the block variable accessible, with something like this, each time the new pageblock variable is defined:

{% with block=pageblock %}
    ...
{% endwith %}

That way we can slowly migrate our apps from block to pageblock without breaking anything.

If this turns out to cause more problems than it solves we can forget it. I just worry that using block as a variable has the potential to break things.

@sdreher
Copy link
Collaborator

sdreher commented Jul 2, 2015

Where would the {% with block=pageblock %} definition be placed to maintain compatability?

@nikolas
Copy link
Member Author

nikolas commented Jul 2, 2015

In all of the templates that this PR updates. I'll add another commit to reflect that proposal.

@nikolas
Copy link
Member Author

nikolas commented Jul 2, 2015

Updating after our conversation to keep anders in the loop: I forgot there's also block getting set in the context as well, which is probably why the tests here are failing (the updated context var here causes that: pagetree/templates/pagetree/testblock.html).

In summary, if we wanted to go in this direction, we would be supporting pageblock as well as block in the context variables. That way it's backwards-compatible. And in case block happens to cause any problems in an app down the road, then we are free to switch it to use the pageblock context var.

@sdreher
Copy link
Collaborator

sdreher commented Jul 2, 2015

@nikolas - here's where block is being set in the context. https://github.com/ccnmtl/django-pagetree/blob/master/pagetree/models.py#L704

thraxil added a commit that referenced this pull request Jul 21, 2015
Use 'pageblock' instead of 'block' as django template var
@thraxil thraxil merged commit a04f0ea into master Jul 21, 2015
@thraxil thraxil deleted the dont-use-block-template-var branch December 12, 2016 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants