Changeset 438


Ignore:
Timestamp:
02.03.2009 15:03:09 (3 years ago)
Author:
chris
Message:
  • bug fixed if PIL is not available
Location:
CMESS/captcha/trunk/com/zms/captcha
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CMESS/captcha/trunk/com/zms/captcha/README.txt

    r362 r438  
    2525HISTORY 
    2626 
     27v1.1.1.200903021501 
     28- bug fixed if PIL is not available 
     29 
    2730v1.1.0.200901211350 
    2831- added ReCaptcha-service 
  • CMESS/captcha/trunk/com/zms/captcha/c_captcha_basic.py

    r362 r438  
    11from com.zms.captcha.CaptchasDotNet import CaptchasDotNet 
    2 from com.zms.captcha.PILCaptcha import * 
     2try: 
     3        from com.zms.captcha.PILCaptcha import * 
     4        noPIL = False 
     5except: 
     6        noPIL = True 
    37from com.zms.captcha.reCaptcha import * 
    48 
     
    5963        def __init__(self, zms_context): 
    6064                C_Captcha_Basic.__init__(self, zms_context) 
    61                  
     65 
    6266                self.id = 'PILCaptcha' 
    6367         
    6468        def GetContent(self): 
     69                if noPIL: 
     70                        raise Exception 
     71 
    6572                temp_img = generateImage(self.zms_context.temp_folder,  
    6673                                                                                                                        self.zms_context.attr_captcha.getObjProperty('pilcaptchaCharCount', self.zms_context.REQUEST),  
     
    7683         
    7784        def IsCodeValid(self): 
     85                if noPIL: 
     86                        raise Exception 
     87         
    7888                if (self.zms_context.REQUEST.SESSION['sess_captcha'] == self.zms_context.REQUEST.form.get('captcha_password', '')): 
    7989                        temp_result = (True, '') 
  • CMESS/captcha/trunk/com/zms/captcha/zms/captcha.metaobj.xml

    r362 r438  
    426426        temp_handler_available = False  
    427427 
     428 
    428429def captcha_getContent(zms_context): 
    429430        if (zms_context.attr_captcha.getObjProperty('captchaService', zms_context.REQUEST) == 'static_pics'): 
    430431                temp_result = zms_context.dt_html(zms_context.getMetaobjAttr('ZMSCaptchaLib', 'captcha_renderDisplay')['custom'], zms_context.REQUEST) 
    431432        elif (temp_handler_available): 
    432                 temp_handler = C_Handler_Captcha(zms_context) 
    433                 temp_result = temp_handler.GetCaptchaContent() 
     433                try: 
     434                        temp_handler = C_Handler_Captcha(zms_context) 
     435                        temp_result = temp_handler.GetCaptchaContent() 
     436                except: 
     437                        temp_result = zms_context.getLangStr('captchaHandlerNotAvailable', zms_context.REQUEST.get('lang', zms_context.getPrimaryLanguage())) 
    434438        else: 
    435439                temp_result = zms_context.getLangStr('captchaHandlerNotAvailable', zms_context.REQUEST.get('lang', zms_context.getPrimaryLanguage())) 
     
    455459                temp_result = zms_context.dt_html(zms_context.getMetaobjAttr('ZMSCaptchaLib', 'captcha_staticValidation')['custom'], zms_context.REQUEST) 
    456460        elif(temp_handler_available): 
    457                 temp_handler = C_Handler_Captcha(zms_context) 
    458                 temp_result = temp_handler.IsCodeValid() 
     461                try: 
     462                        temp_handler = C_Handler_Captcha(zms_context) 
     463                        temp_result = temp_handler.IsCodeValid() 
     464                except: 
     465                        temp_result = zms_context.getLangStr('captchaHandlerNotAvailable', zms_context.REQUEST.get('lang', zms_context.getPrimaryLanguage())) 
    459466        else: 
    460467                temp_result = zms_context.getLangStr('captchaHandlerNotAvailable', zms_context.REQUEST.get('lang', zms_context.getPrimaryLanguage())) 
     
    536543<item key="name"><![CDATA[CaptchaLib]]></item> 
    537544<item key="package"><![CDATA[com.zms.captcha]]></item> 
    538 <item key="revision"><![CDATA[1.1.0]]></item> 
     545<item key="revision"><![CDATA[1.1.1]]></item> 
    539546<item key="type"><![CDATA[ZMSLibrary]]></item> 
    540547</dictionary> 
     
    567574<item key="name"><![CDATA[com.zms.captcha]]></item> 
    568575<item key="package"></item> 
    569 <item key="revision"><![CDATA[1.1.0]]></item> 
     576<item key="revision"><![CDATA[1.1.1]]></item> 
    570577<item key="type"><![CDATA[ZMSPackage]]></item> 
    571578</dictionary> 
Note: See TracChangeset for help on using the changeset viewer.