From 640f1f698cd8a90b1dbd617cd8550278c3b02161 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Wed, 20 Aug 2008 08:38:51 +0000
Subject: [PATCH] As the list of available actions is not strictly defined,
 prevent mistake if an action is unknown.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23048 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessTemplate.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 0b1b450a00..3a8e94a932 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -423,6 +423,10 @@ class BaseTemplateItem(Implicit, Persistent):
           self.uninstall(context, trash=1, object_path=path, **kw)
         elif action == 'remove':
           self.uninstall(context, trash=0, object_path=path, **kw)
+        else:
+          # As the list of available actions is not strictly defined,
+          # prevent mistake if an action is not handled
+          raise ValueError, 'Unknown action "%s"' % action
 
 
   def trash(self, context, new_item, **kw):
@@ -665,6 +669,10 @@ class ObjectTemplateItem(BaseTemplateItem):
       subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=1, **kw)
     elif action == 'install':
       subobjects_dict = self.portal_trash.backupObject(trashbin, container_path, object_id, save=0, **kw)
+    else:
+      # As the list of available actions is not strictly defined,
+      # prevent mistake if an action is not handled
+      raise ValueError, 'Unknown action "%s"' % action
     return subobjects_dict
 
   def beforeInstall(self):
-- 
2.30.9