Created
May 2, 2014 08:04
-
-
Save ojii/8dcc89bb1118fb8b753b to your computer and use it in GitHub Desktop.
last page on path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def last_page_on_path(path): | |
""" | |
Given a path (eg /a/b/c/d/e/), find the "last" page on that path. | |
If we have a CMS tree of: | |
|-a | |
| |-b | |
| | |-c | |
But no pages after c, returns c. | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the parameter 'path' here, exactly? A string?
Also, do you need the last page proper, as in CMSPage, or the last node? So, if, in the path /a/b/c/d/e/, I have an apphook on d, and this app has a DetailView with slug 'e', do you want this to return 'd' or 'e'?