Created
October 6, 2016 15:37
-
-
Save facuescobar/9c9897a0e9f22b6027a8ed5dbc75b173 to your computer and use it in GitHub Desktop.
load_skeleton_for_section_as_frontpage module
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
@handlers.register(condition=lambda obj: obj.env.site.extra.get('use_section_as_homepage') and obj.env.page_type == page_types.FRONTPAGE) | |
def load_skeleton_for_section_as_frontpage(self): | |
subpage_template_name = None | |
for subpage in Subpages.get_subpages(self.env.site.id): | |
if subpage.get('is_homepage', False): | |
subpage_template_name = u'section_{}.xml'.format(subpage['url'].lower()) | |
break | |
if subpage_template_name: | |
try: | |
return load_skeleton_from(self.env, subpage_template_name) | |
except SkeletonNotFound: | |
pass | |
return load_skeleton_from(self.env, 'subpage.xml') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment