Dexterity example: override nextURL
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
class BaseEditForm(DefaultEditForm): | |
def nextURL(self): | |
''' Try to guess in a smart way what will bethe next url | |
''' | |
next_url = super(BaseEditForm, self).nextURL() | |
current_tab = getattr(self, 'tab_id', '') | |
if not current_tab: | |
return next_url | |
if not current_tab in self.wizard_tabs: | |
return next_url | |
current_index = self.wizard_tabs.index(current_tab) | |
if getattr(self.context, '%s_compiled' % current_tab, False): | |
#project is already compiled, and we return to the view | |
return next_url | |
if current_index == len(self.wizard_tabs) - 1: | |
return next_url | |
return "%s/@@%s" % ( | |
self.context.absolute_url(), | |
self.wizard_tabs[current_index + 1] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment