Page.publisher_public_id sometimes loses it's reference
See original GitHub issueOur production systems are currently on Python 2.7, Django 1.7, CMS 3.1, MySQL 5.6. (We are in the process of moving to Django 1.8, CMS 3.2.)
Occasionally (at least 3 times in the last 6 months) publishing a page causes the cms_page.publisher_public_id
foreign key to get set to null on either a) the draft version or b) both the draft and non-draft versions of the ‘pair’ of cms_page
records. This corrupt data can then result in several unhandled exceptions, including attempting to invoke cms.api.get_page_draft
on a non-draft page:
def get_page_draft(page):
"""
Returns the draft version of a page, regardless if the passed in
page is a published version or a draft version.
:param page: The page to get the draft version
:type page: :class:`cms.models.pagemodel.Page` instance
:return page: draft version of the page
:type page: :class:`cms.models.pagemodel.Page` instance
"""
if page:
if page.publisher_is_draft:
return page
else:
return page.publisher_draft
else:
return None
Specifically, when invoked on a non-draft page, the line return page.publisher_draft
throws an exception because the reverse lookup fails due to the foreign key being null.
This issue is intermittent and we cannot reproduce the problem, so unfortunately, I’m unable to run it through a debugger to get any better information.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top GitHub Comments
Below is a Django management command that fixes the null/lost/corrupt
cms_page.publisher_public_id
columns. It works on the assumption that the equivalent columns incms_title
are okay. In our experience, it’s only thecms_page.publisher_public_id
columns that get broken, so this assumption holds for us.Closing as this issue appears to be stale and there is no feedback that the proposed fixes in 3.4 did not work. I have never heard of this on any project 3.5+ so assuming fixed.
Due to the age of this issue we are unable to safely accept the contribution. If you feel this issue is still required please inform a member of our technical committee: nicolai@django-cms.org.
Nevertheless we thank you for your participation and would like to emphasize that we do not want to discourage you in your contribution to the django CMS project. On the contrary, we encourage everyone who is interested in the success of django CMS to join us!
If you want to learn more about the work of the technical committee, our product vision and how you can become a member of the dCA, you can find all information here:
We are looking forward to every companion who would like to shape the future of django CMS together with us!
If you have any questions, feel free to reach out to Nicolai, our Community Manager: nicolai@django-cms.org
Sign up for the Association now!