Skip to content

Instantly share code, notes, and snippets.

Created November 19, 2015 08:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Dexterity example: override nextURL
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.wizard_tabs[current_index + 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment