diff options
Diffstat (limited to 'ishtar_common/wizards.py')
| -rw-r--r-- | ishtar_common/wizards.py | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 8bb0dc00b..97bb6fb37 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -1,6 +1,6 @@  #!/usr/bin/env python  # -*- coding: utf-8 -*- -# Copyright (C) 2010-2015  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2016  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet>  # This program is free software: you can redistribute it and/or modify  # it under the terms of the GNU Affero General Public License as @@ -90,15 +90,14 @@ def check_rights_condition(rights):          return False      return func - +# buggy and unecessary at least for the moment... +"""  def _check_right(step, condition=True):      '''Return a method to check the right for a specific step'''      def check_right(self):          cond = condition -        # TODO: cond.__name__ != 'check_right' prevent unexplicated -        # infinite loop... to be fixed -        if callable(cond) and cond.__name__ != 'check_right': -            cond = cond(self) +        if callable(condition): +            cond = condition(self)          if not cond:              return False          return True @@ -108,6 +107,7 @@ def _check_right(step, condition=True):          return self.request.user.ishtaruser.has_right(              ('administrator', step), session=self.request.session)      return check_right +"""  class Wizard(NamedUrlWizardView): @@ -124,6 +124,8 @@ class Wizard(NamedUrlWizardView):      filter_owns = {}      current_obj_slug = '' +    ''' +    # buggy and unecessary...      def __init__(self, *args, **kwargs):          """Check right for each step of the wizard"""          super(Wizard, self).__init__(*args, **kwargs) @@ -131,6 +133,7 @@ class Wizard(NamedUrlWizardView):              condition = self.condition_dict.get(form_key, True)              cond = _check_right(form_key, condition)              self.condition_dict[form_key] = cond +    '''      def dispatch(self, request, *args, **kwargs):          self.current_right = kwargs.get('current_right', None) | 
