Changeset 665
- Timestamp:
- 11/28/06 10:41:28
- Files:
-
- qPloneCaptchas/trunk/CaptchaTool.py (modified) (1 diff)
- qPloneCaptchas/trunk/Extensions/Install.py (modified) (3 diffs)
- qPloneCaptchas/trunk/__init__.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneCaptchas/trunk/CaptchaTool.py
r664 r665 3 3 from AccessControl import ClassSecurityInfo 4 4 5 def constructCaptchaTool(self, id, title='', timeout_mins=20,6 addNotification=None, delNotification=None,7 limit=0, period_secs=20,8 REQUEST=None):9 ob = CaptchaTool(id, title, timeout_mins,10 addNotification, delNotification,11 limit=limit, period_secs=period_secs)12 self._setObject(id, ob)13 if REQUEST is not None:14 return self.manage_main(self, REQUEST, update_menu=1)15 16 5 class CaptchaTool(TransientObjectContainer): 17 6 """portal_captcha tool class 18 7 """ 8 meta_type = 'CaptchaTool' 19 9 security = ClassSecurityInfo() 20 10 security.declarePublic('addExpiredKey') 11 12 def __init__(self, id='portal_captchas', title='', timeout_mins=60, addNotification=None, 13 delNotification=None, limit=0, period_secs=60): 14 TransientObjectContainer.__init__(self, id, title, timeout_mins, addNotification, 15 delNotification, limit, period_secs) 16 21 17 def addExpiredKey(self, key): 22 18 self.new(key) qPloneCaptchas/trunk/Extensions/Install.py
r664 r665 1 1 from Products.qPloneCaptchas.config import * 2 from Products.qPloneCaptchas.CaptchaTool import constructCaptchaTool3 2 from Products.CMFCore.utils import getToolByName 4 3 from StringIO import StringIO … … 15 14 portal = getToolByName(self, 'portal_url').getPortalObject() 16 15 # add captchas_tool 17 if not hasattr(portal, TOOL_ID): 18 constructCaptchaTool(portal, id=TOOL_ID, timeout_mins=60) 16 install_tool(self, out) 19 17 20 18 safeEditProperty(self, 'captcha_key', generateKey(8)) … … 101 99 for i in range(length): key += str(randint(0, 9)) 102 100 return key 101 102 def install_tool(self, out): 103 if not hasattr(self, 'portal_captchas'): 104 addTool = self.manage_addProduct['qPloneCaptchas'].manage_addTool 105 addTool('CaptchaTool') qPloneCaptchas/trunk/__init__.py
r664 r665 11 11 tools = (CaptchaTool.CaptchaTool, ) 12 12 def initialize(context): 13 context.registerClass(CaptchaTool.CaptchaTool, 14 constructors=(CaptchaTool.constructCaptchaTool,)) 15 16 ToolInit("CaptchaTool", 13 ToolInit(meta_type="CaptchaTool", 17 14 tools=tools, 15 product_name=config.PRODUCT_NAME, 18 16 icon=config.TOOL_ICON,).initialize(context)
