- Timestamp:
- 26.11.2008 10:45:44 (3 years ago)
- Location:
- CMESS/forum/branches/captcha/cmess
- Files:
-
- 1 edited
- 1 moved
-
. (moved) (moved from CMESS/forum/branches/captcha/org/cmess)
-
forum/c_handler_captcha.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CMESS/forum/branches/captcha/cmess/forum/c_handler_captcha.py
r305 r315 1 from org.cmess.forum.c_captcha_basic import C_Captcha_Basic2 from org.cmess.forum.c_captcha_basic import C_Captcha_Dot_Net1 from com.zms.captcha.c_captcha_basic import C_Captcha_Basic 2 from com.zms.captcha.c_captcha_basic import C_Captcha_Dot_Net 3 3 4 4 class C_Handler_Captcha: 5 def __init__(self, mode): 6 self.captcha_mode = mode 7 self.obj_dict = {} 8 9 temp_obj = C_Captcha_Dot_Net() 10 self.RegisterCaptchaObj(temp_obj.GetID(), temp_obj) 5 def __init__(self, zms_context): 6 try: 7 if (zms_context.attr_captcha.getObjProperty('captchaService', zms_context.REQUEST) == 'captcha.net'): 8 self.captcha_obj = C_Captcha_Dot_Net(zms_context) 9 else: 10 self.captcha_obj = None 11 except: 12 self.captcha_obj = None 11 13 12 14 def GetCaptchaContent(self): 13 if (self. obj_dict.has_key(self.captcha_mode)):14 temp_result = self. obj_dict[self.captcha_mode].GetContent()15 if (self.captcha_obj is not None): 16 temp_result = self.captcha_obj.GetContent() 15 17 else: 16 18 temp_result = '' … … 18 20 return temp_result 19 21 20 def IsCodeValid(self , REQUEST):21 if (self. obj_dict.has_key(self.captcha_mode)):22 temp_result = self. obj_dict[self.captcha_mode].IsCodeValid(REQUEST)22 def IsCodeValid(self): 23 if (self.captcha_obj is not None): 24 temp_result = self.captcha_obj.IsCodeValid() 23 25 else: 24 26 temp_result = False 25 27 26 28 return temp_result 27 28 def RegisterCaptchaObj(self, id, obj):29 if (obj is not None and isinstance(obj, C_Captcha_Basic)):30 if (self.obj_dict.has_key(id)):31 self.obj_dict.update({id : obj})32 else:33 self.obj_dict[id] = obj
Note: See TracChangeset
for help on using the changeset viewer.
