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

Fix support for reversion >=1.9 #4883

Merged
merged 11 commits into from
Jan 14, 2016

Conversation

yakky
Copy link
Member

@yakky yakky commented Jan 2, 2016

Slowly approaching to full compatibility.
Reversion logic has changed a lot: 1.8 & 1.9+ compatibiliy layer added, to be dropped in 3.3 when we drop Django 1.6/1.7 and can thus focus on reversion 1.10+

Fix #4784
This is a blocker for #4812 (which is complete as far as Django 1.9 is involved)

@yakky yakky added this to the 3.2.1 milestone Jan 2, 2016
@yakky yakky changed the title [WiP] Fix support for reversion >=1.9 Fix support for reversion >=1.9 Jan 4, 2016
@yakky
Copy link
Member Author

yakky commented Jan 4, 2016

@FinalAngel @mkoistinen this is complete, but it requires extensive testing as many moving parts have changed and 1.10 has a very different admin integration logic

@yakky yakky mentioned this pull request Jan 5, 2016
@@ -1,6 +1,26 @@
# -*- coding: utf-8 -*-
import reversion
from reversion.revisions import RegistrationError, VersionAdapter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're importing the same stuff even on ImportError, it's best to explicitly target the imports that will fail and add some comment as to why they would fail ie. "Reversion >= 1.x compat".

Also the revision manager assignments can easily be outside of the ImportError try/except and placed on their own try/except that catches the AttributeError, more specifically only the revision_manager seems to change location

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I could easily change this in a simple version checking.
Having a simple try / except will make easier to remove the legacy imports in 3.3 (as we can use reversion 1.10 for all the supported Django versions) and a single section makes the code more readable. I'll happily add a comment to clarify the reason of the code style

@yakky yakky self-assigned this Jan 7, 2016
@@ -1,9 +1,6 @@
-r requirements_base.txt
Django>=1.8,<1.9
django-reversion>=1.8,<1.9
django-classy-tags>=0.6.1
django-reversion==1.10.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be ...>=1.10,<1.11?

@mkoistinen
Copy link
Contributor

Good work, @yakky I have personally tested this a lot (in a test project, not a live project) and seems to work well. I've made a couple of comments about the requirements, but otherwise LGTM.

see note below

@mkoistinen
Copy link
Contributor

OK, I've now tested this in existing projects. Restoring revisions created recently (since the new django-revision was installed?), seem to work OK. Restoring older revisions fails with a Database Integrity issue as show here: https://gist.github.com/mkoistinen/140ff90d2ea077629588. It is possible (but rather unlikely) that this could be related to some previous corruption in the DB.

Also, after restoring even a "working" revision, when I attempt to publish them, the AJAX request that occurs as a result of pressing "Publish" returns this: https://gist.github.com/mkoistinen/5aae3398498316659f56. I've been able to reproduce this errors on-demand using a new project (using djangocms-installer).

Finally, pressing the "View published" on a restored page gives me: https://gist.github.com/mkoistinen/37d4f775c4e142783fb8. This is also repeatable.

=(

@yakky
Copy link
Member Author

yakky commented Jan 13, 2016

@mkoistinen I'll have a look at this shortly

@yakky
Copy link
Member Author

yakky commented Jan 14, 2016

@mkoistinen I've been able to reproduce both issues and they are hopefully fixed

@mkoistinen
Copy link
Contributor

Awesome! My tests look good too. I'll merge this, thanks @yakky!

mkoistinen added a commit that referenced this pull request Jan 14, 2016
@mkoistinen mkoistinen merged commit 2598bea into django-cms:release/3.2.x Jan 14, 2016
@coveralls
Copy link

coveralls commented Feb 15, 2018

Coverage Status

Coverage increased (+0.07%) to 89.3% when pulling 5d94bcd on yakky:feature/fix_reversion into ee7d1cb on divio:release/3.2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants