Skip to content

Page._contents not cached properly when the Content does not exist #22

Closed
andrewebdev opened this Issue Nov 15, 2012 · 2 comments

1 participant

@andrewebdev
Owner

Page.get_content()

page.contents does not work as intended. For some reason, the DB is being queried every time, and it's not cached in the page instance.

This happens when the Page does not have PageContent saved for the class yet, and a brand new lookup happens everytime we attempt to add content to a template.

@andrewebdev
Owner

A simple fix for this would be to set self._contents = 'empty', which will prevent the lookup from happening again.
Although a situation may exist where we would like to force it to load the content again. So we need to look at how we would do this. Maybe a method that forces a reload?

@andrewebdev andrewebdev reopened this Nov 15, 2012
@andrewebdev andrewebdev was assigned Dec 4, 2012
@andrewebdev
Owner

fixed in 76fdaec

Forcing reload is actually very simple. Just manually set page._contents = None

@andrewebdev andrewebdev closed this Dec 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.