{"action":"created","issue":{"url":"https://api.github.com/repos/stephenmcd/mezzanine/issues/1654","repository_url":"https://api.github.com/repos/stephenmcd/mezzanine","labels_url":"https://api.github.com/repos/stephenmcd/mezzanine/issues/1654/labels{/name}","comments_url":"https://api.github.com/repos/stephenmcd/mezzanine/issues/1654/comments","events_url":"https://api.github.com/repos/stephenmcd/mezzanine/issues/1654/events","html_url":"https://github.com/stephenmcd/mezzanine/pull/1654","id":172052599,"number":1654,"title":"Fixed crash in Page.get_ascendants with non-current site","user":{"login":"AlexHill","id":1011483,"avatar_url":"https://avatars.githubusercontent.com/u/1011483?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexHill","html_url":"https://github.com/AlexHill","followers_url":"https://api.github.com/users/AlexHill/followers","following_url":"https://api.github.com/users/AlexHill/following{/other_user}","gists_url":"https://api.github.com/users/AlexHill/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexHill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexHill/subscriptions","organizations_url":"https://api.github.com/users/AlexHill/orgs","repos_url":"https://api.github.com/users/AlexHill/repos","events_url":"https://api.github.com/users/AlexHill/events{/privacy}","received_events_url":"https://api.github.com/users/AlexHill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-19T04:32:10Z","updated_at":"2016-08-22T04:57:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/stephenmcd/mezzanine/pulls/1654","html_url":"https://github.com/stephenmcd/mezzanine/pull/1654","diff_url":"https://github.com/stephenmcd/mezzanine/pull/1654.diff","patch_url":"https://github.com/stephenmcd/mezzanine/pull/1654.patch"},"body":"See issue #1637.\r\n\r\nThe problem is that `Page.get_ascendants()` assumes that `self` will be a `Page` assigned to the current site, and therefore that `PageManager.with_ascendants_for_slug(self.slug)` will return at least one `Page`.\r\n\r\nThis fixes the problem, but the correct result is obtained by doing recursive database queries up the page tree rather than the single query used by `with_ascendants_for_slug()`.\r\n\r\nIf we think that's acceptable (to fix something that wasn't working at all before) we can merge this as-is, otherwise some refactoring will likely be necessary."},"comment":{"url":"https://api.github.com/repos/stephenmcd/mezzanine/issues/comments/241315223","html_url":"https://github.com/stephenmcd/mezzanine/pull/1654#issuecomment-241315223","issue_url":"https://api.github.com/repos/stephenmcd/mezzanine/issues/1654","id":241315223,"user":{"login":"AlexHill","id":1011483,"avatar_url":"https://avatars.githubusercontent.com/u/1011483?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexHill","html_url":"https://github.com/AlexHill","followers_url":"https://api.github.com/users/AlexHill/followers","following_url":"https://api.github.com/users/AlexHill/following{/other_user}","gists_url":"https://api.github.com/users/AlexHill/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexHill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexHill/subscriptions","organizations_url":"https://api.github.com/users/AlexHill/orgs","repos_url":"https://api.github.com/users/AlexHill/repos","events_url":"https://api.github.com/users/AlexHill/events{/privacy}","received_events_url":"https://api.github.com/users/AlexHill/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T04:57:29Z","updated_at":"2016-08-22T04:57:29Z","body":"The site filtering happens in `CurrentSiteManager`, whose behaviour depends on global state (the site ID stored on the request or in settings). To change that behaviour we could temporarily set `request.site_id` or some other thread-local flag that would then be used by `CurrentSiteManager` to ignore the current site or filter on a different one. Wrap that whole process in a `with_site_id` context manager to make it more foolproof.\r\n\r\nAlternatively, we could introduce a new manager on `Page` that doesn't inherit from `CurrentSiteManager` so that we can get a QuerySet of all `Page`s in a more standard way. That would mean duplicating the whole inheritance chain from `PageManager` up, if we wanted to retain all the functionality of `DisplayableManager`, `PublishedManager` etc."}}
{"actor":{"display_login":"AlexHill"}}