summaryrefslogtreecommitdiff
path: root/archaeological_operations/wizards.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r--archaeological_operations/wizards.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py
index ddad8dd2e..d4830a2e7 100644
--- a/archaeological_operations/wizards.py
+++ b/archaeological_operations/wizards.py
@@ -526,6 +526,28 @@ def is_not_preventive(form_name, model, type_key='operation_type', key=''):
return func
+def is_judiciary(form_name, model, type_key='operation_type'):
+ def func(self):
+ request = self.request
+ storage = self.storage
+ if storage.prefix not in request.session or \
+ 'step_data' not in request.session[storage.prefix] or \
+ form_name not in request.session[storage.prefix]['step_data'] \
+ or form_name + '-' + type_key not in \
+ request.session[storage.prefix]['step_data'][form_name]:
+ return False
+ try:
+ typ = request.session[storage.prefix][
+ 'step_data'][form_name][form_name + '-' + type_key]
+ if type(typ) in (list, tuple):
+ typ = typ[0]
+ typ = int(typ)
+ return model.is_judiciary(typ)
+ except ValueError:
+ return False
+ return func
+
+
def has_associated_file(form_name, file_key='associated_file', negate=False):
def func(self):
request = self.request