diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-24 16:07:26 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-10-24 16:07:26 +0200 |
commit | 9f0452b760d9438ea0d3ec2c7461ce7af58c6765 (patch) | |
tree | 2a9f0b374d14e4ef5aa72fcf113584a0adacb5fc /ishtar_common/management | |
parent | 588d0473b5f8614ccb0cdedd583be819dac4ebaf (diff) | |
download | Ishtar-9f0452b760d9438ea0d3ec2c7461ce7af58c6765.tar.bz2 Ishtar-9f0452b760d9438ea0d3ec2c7461ce7af58c6765.zip |
Test: do not test last_modified on rollback
Diffstat (limited to 'ishtar_common/management')
-rw-r--r-- | ishtar_common/management/commands/generate_rights.py | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/ishtar_common/management/commands/generate_rights.py b/ishtar_common/management/commands/generate_rights.py deleted file mode 100644 index 75b1cf807..000000000 --- a/ishtar_common/management/commands/generate_rights.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2011 É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 -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. - -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# See the file COPYING for details. - -import sys - -from django.core.management.base import BaseCommand, CommandError -from django.core.exceptions import ObjectDoesNotExist - -import ishtar_base.forms_main as ishtar_forms -import ishtar_base.models as models - -class Command(BaseCommand): - args = '' - help = 'Regenerate rights for current forms' - - def handle(self, *args, **options): - wizards = [] - wizard_steps = {} - for attr in dir(ishtar_forms): - if not attr.endswith('_wizard'): - continue - wizard = getattr(ishtar_forms, attr) - url_name = wizard.url_name - try: - wizard_obj = models.Wizard.objects.get(url_name=url_name) - except ObjectDoesNotExist: - wizard_obj = models.Wizard.objects.create(url_name=url_name) - wizard_obj.save() - #self.stdout.write('* Wizard "%s" added\n' % url_name) - sys.stdout.write('* Wizard "%s" added\n' % url_name) - wizard_steps[url_name] = [] - for idx, step_url_name in enumerate(wizard.form_list.keys()): - form = wizard.form_list[step_url_name] - if issubclass(form, ishtar_forms.FinalForm): - break # don't reference the final form - step_values = {'name':unicode(form.form_label), - 'order':idx} - try: - step_obj = models.WizardStep.objects.get(wizard=wizard_obj, - url_name=step_url_name) - for k in step_values: - setattr(step_obj, k, step_values[k]) - step_obj.save() - except ObjectDoesNotExist: - step_values.update({'wizard':wizard_obj, - 'url_name':step_url_name}) - step_obj = models.WizardStep.objects.create(**step_values) - step_obj.save() - #self.stdout.write('* Wizard step "%s" added\n' \ - # % unicode(form.form_label)) - sys.stdout.write('* Wizard step "%s" added\n' \ - % unicode(form.form_label)) - wizard_steps[url_name].append(step_url_name) - #self.stdout.write('Successfully regeneration of wizard rights\n') - sys.stdout.write('Successfully regeneration of wizard rights\n') |