Skip to content

Commit

Permalink
Merge pull request #60 from dmitry-sobolev/master
Browse files Browse the repository at this point in the history
Ran 81 tests in 15.502s
OK (skipped=1)
  • Loading branch information
batiste committed May 16, 2012
2 parents 2522163 + 3339e58 commit 05dd0cb
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,23 @@ def resolve_page(self, request, context, is_staff):
exclude_drafts=(not is_staff))
if page:
return page
# if the complete path didn't worked out properly we gonna
# if the complete path didn't worked out properly
# and if didn't used PAGE_USE_STRICT_URL setting we gonna
# try to see if it might be a delegation page.
# To do that we remove the right part of the url and try again
# to find a page that match
path = remove_slug(path)
while path is not None:
page = Page.objects.from_path(path, lang,
exclude_drafts=(not is_staff))
# find a match. Is the page delegating?
if page:
if page.delegate_to:
return page
if not settings.PAGE_USE_STRICT_URL:
path = remove_slug(path)
return page
while path is not None:
page = Page.objects.from_path(path, lang,
exclude_drafts=(not is_staff))
# find a match. Is the page delegating?
if page:
if page.delegate_to:
return page
path = remove_slug(path)

return None

def resolve_alias(self, request, path, lang):
alias = PageAlias.objects.from_path(request, path, lang)
Expand Down

0 comments on commit 05dd0cb

Please sign in to comment.