Author: jmorliaguet Date: Thu Jun 29 19:05:19 2006 New Revision: 3561 Modified: cpsskins/branches/paris-sprint-2006/controllers/themepage.py cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt
Log: - reset the default page of a theme if the default page is removed Modified: cpsskins/branches/paris-sprint-2006/controllers/themepage.py ============================================================================== --- cpsskins/branches/paris-sprint-2006/controllers/themepage.py (original) +++ cpsskins/branches/paris-sprint-2006/controllers/themepage.py Thu Jun 29 19:05:19 2006 @@ -46,8 +46,13 @@ """What to do when the element has been removed. """ element = self.element - getThemeManager(element).removeFormats(element) + tmutil = getThemeManager(element) + tmutil.removeFormats(element) theme = element.getTheme() theme.unregisterUtility(element, IThemePage, getName(element)) + if tmutil.getDefaultPage(theme) is None: + pages = tmutil.getPages(theme) + if pages: + tmutil.setAsDefault(pages[0]) Modified: cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt ============================================================================== --- cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt (original) +++ cpsskins/branches/paris-sprint-2006/doc/theme-structure.txt Thu Jun 29 19:05:19 2006 @@ -153,4 +153,23 @@ |_ Page 1 (default: False) +if we remove a page that was used by default, the first page of the theme +will be use by default instead: + + >>> del theme2[u'ThemePage-2'] + + >>> inspect() + - Theme (default: False) + |_ Default page (default: True) + - Theme 2 (default: True) + |_ Page 1 (default: True) + +we can also remove the only page of a theme: + + >>> del theme2[u'ThemePage'] + + >>> inspect() + - Theme (default: False) + |_ Default page (default: True) + - Theme 2 (default: True) -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins