def get(self): available = dict([(t.value, t.title) for t in AvailableSiteLayouts(self.context)]) applied = 'index.html' applied_context = getSite() context = self.context adapted = context_adapted = ILayoutAware(context) selected = adapted.pageSiteLayout if selected is None: context = aq_parent(context) while not ISiteRoot.providedBy(context): adapted = ILayoutAware(context, None) if adapted and adapted.sectionSiteLayout: selected = adapted.sectionSiteLayout break context = aq_parent(context) if selected: applied = selected applied_context = context return { 'success': True, 'available': available, 'applied': applied, 'context': utils.get_path(self.context), 'applied_context': utils.get_path(applied_context), 'page_layout': context_adapted.pageSiteLayout, 'section_layout': context_adapted.sectionSiteLayout, 'folder': IDexterityContainer.providedBy(self.context) }
def get_path(self, obj): return utils.get_path(obj)