From 9930e40b5f03192df939d3f4bc3c5da81dde5dd9 Mon Sep 17 00:00:00 2001
From: Tatuya Kamada <tatuya@nexedi.com>
Date: Mon, 5 Apr 2010 08:11:22 +0000
Subject: [PATCH] Bug #1724 : fix TALES calculations on Captcha Fields

Accessing self.values[property_id] skips all TALES/override computations, only
do it for properties that are set by the Captcha Provider.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34286 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/CaptchaField.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Form/CaptchaField.py b/product/ERP5Form/CaptchaField.py
index 50c5ba3c4a..2f80a82735 100644
--- a/product/ERP5Form/CaptchaField.py
+++ b/product/ERP5Form/CaptchaField.py
@@ -312,14 +312,16 @@ class CaptchaField(ZMIField):
   
   security.declareProtected('Access contents information', 'get_value')
   def get_value(self, id, **kw):
-    if self.values.has_key(id):
+    if id in self.getCaptchaCustomPropertyList():
       return self.values[id]
     return ZMIField.get_value(self, id, **kw)
 
   def getCaptchaCustomPropertyList(self):
-    captcha_type = self.get_value("captcha_type")
+    if hasattr(self, "__extraPropertyList"):
+      return self.__extraPropertyList
+    captcha_type = ZMIField.get_value(self, "captcha_type")
     captcha_provider = CaptchaProviderFactory.getProvider(captcha_type)
     extraPropertyList = captcha_provider.getExtraPropertyList()
     self.__extraPropertyList = [x.id for x in extraPropertyList]
     return extraPropertyList
-    
\ No newline at end of file
+    
-- 
2.30.9