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

Django 1.4 - minor compatibility issue #14

Merged
merged 3 commits into from
Jun 7, 2012
Merged

Django 1.4 - minor compatibility issue #14

merged 3 commits into from
Jun 7, 2012

Conversation

tomscytale
Copy link
Contributor

No description provided.

@ojii
Copy link
Collaborator

ojii commented Mar 5, 2012

Thanks for this pull request.

I'm not really a fan of try...except... where it isn't required, so maybe this should use getattr

@tomscytale
Copy link
Contributor Author

updated - please look again.

@ojii
Copy link
Collaborator

ojii commented Mar 5, 2012

Alright. Now had a closer look. Does Django 1.4 just remove that attribute? It's not replaced with anything?

@tomscytale
Copy link
Contributor Author

@tomscytale
Copy link
Contributor Author

and...
django_trunk/django$ grep -r parent_name_expr *
django_trunk/django$

@ericpalakovichcarr
Copy link

Any movement on this?

@ojii
Copy link
Collaborator

ojii commented Mar 25, 2012

Not really sure this fix will actually work as it will result in a Variable.resolve or FilterExpression.resolve being called with None. Which will break. What needs to happen is there should be a check for the extend_node being dynamic or not.

@tomscytale
Copy link
Contributor Author

On Sun, Mar 25, 2012 at 7:54 PM, Jonas Obrist <
reply@reply.github.com

wrote:

Not really sure this fix will actually work as it will result in a
Variable.resolve or FilterExpression.resolve being called with
None. Which will break. What needs to happen is there should be a check
for the extend_node being dynamic or not.

Can you clarify? I don't see any calls to Variable.resolve or
FilterExpression.resolve.
And I don't understand how/why the code should check for extend_node
being dynamic.
Are we talking about the same patch?

t

@ojii
Copy link
Collaborator

ojii commented Mar 25, 2012

@tomscytale
Copy link
Contributor Author

On Sun, Mar 25, 2012 at 11:46 PM, Jonas Obrist <
reply@reply.github.com

wrote:

https://github.com/django/django/blob/master/django/template/loader_tags.py#L88

context will be set to None if my patch is applied or not.

The only change my patch makes is to check for the value of the attribute
extend_node.parent_name_expr - I added a check to see if such an
attribute existed before the check for the value of the attribute.
This prevents an AttributeError when sekizai is used with Django1.4 where
the attribute in question does not exist.
My patch merely ensures that the check works properly and does not change
the behaviour of the the subsequent lines.

In particular you seem to be talking about the line

parent = extend_node.get_parent(None)

this does indeed cause context to have a value of None in
https://github.com/django/django/blob/master/django/template/loader_tags.py#L88

However this is not related to my patch - context will be set to
None regardless if my patch is applied or not.

t

@AdrianRibao
Copy link

I used this patch in a project usign django 1.4 and everything works fine.

@ojii
Copy link
Collaborator

ojii commented Mar 26, 2012

Thanks for verifying @AdrianRibao

@tomscytale in the old version, if parent_name_expr the context was set to None but never used. Now with this change in Django and your patch the None context will actually be used and I feared that this might cause issues.

@tomscytale
Copy link
Contributor Author

are you sure? as far as I can tell the context is used unless extend_node.partent_name_expr is True. And usually it is False. So in normal circumstances context is None, right?

@andialbrecht
Copy link

FWIW this is the change that removed parent_name_expr: django/django@5cedcb4
And the corresponding Django ticket: https://code.djangoproject.com/ticket/17660

@ojii
Copy link
Collaborator

ojii commented Mar 28, 2012

Thanks andi, I will still need to actually test this pull request before I can merge it, this will hopefully happen next week when I should have a little more time to work on this.

@tfmorris
Copy link

Is it next week yet? :-)

The patch worked for me and the current code definitely will not work with Django 1.4.

@parruc
Copy link

parruc commented Apr 30, 2012

The patch is working here. The old code does not work...
News on testing for merge?

@AdrianRibao
Copy link

This patch works, it should be merged ASAP. It breaks 1.4 I've been using it for a long time in production enviroments.

@kenzic
Copy link

kenzic commented May 11, 2012

I second what @AdrianRibao, @parruc, and @tfmorris said.

@ericpalakovichcarr
Copy link

Thirded.

@ojii
Copy link
Collaborator

ojii commented May 11, 2012

Noted, will merge this/make sekizai 1.4 compatible post-djangocon europe

ojii added a commit that referenced this pull request Jun 7, 2012
Django 1.4 - minor compatibility issue
@ojii ojii merged commit 5018f46 into django-cms:master Jun 7, 2012
@ojii
Copy link
Collaborator

ojii commented Jun 7, 2012

just noticed that this patch actually breaks a test. will investigate

@ojii
Copy link
Collaborator

ojii commented Jun 7, 2012

the issue is exactly what I described above, get_parent is called with None on a dynamic extends tag.

@emilian
Copy link

emilian commented Oct 11, 2012

Is there a better patch to get this working with Django 1.4?

@ojii
Copy link
Collaborator

ojii commented Oct 11, 2012

I merged the patch. sekizai master now supports up to the in-development 1.5 release of Django. (On Python versions up to 3.2).

I just gotta make a proper release for the new version.

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.

9 participants