[1] | 1 | from Products.CMFCore.DirectoryView import registerDirectory |
---|
| 2 | from App.version_txt import getZopeVersion |
---|
| 3 | from Products.CMFCore.utils import ToolInit |
---|
| 4 | import logging |
---|
| 5 | from AccessControl import allow_module, ModuleSecurityInfo |
---|
| 6 | import config |
---|
| 7 | import CaptchaTool |
---|
| 8 | |
---|
| 9 | allow_module('Products.qPloneCaptchas.utils') |
---|
| 10 | allow_module('Products.qPloneCaptchas.config') |
---|
| 11 | registerDirectory('skins', config.GLOBALS) |
---|
| 12 | |
---|
| 13 | tools = (CaptchaTool.CaptchaTool, ) |
---|
| 14 | def initialize(context): |
---|
| 15 | ToolInit(meta_type="CaptchaTool", |
---|
| 16 | tools=tools, |
---|
| 17 | product_name=config.PRODUCT_NAME, |
---|
| 18 | icon=config.TOOL_ICON,).initialize(context) |
---|
| 19 | |
---|
| 20 | def MessageFactory(projectname): |
---|
| 21 | "Get a i18n message factory" |
---|
| 22 | MessageFactory = lambda x: lambda y: y |
---|
| 23 | try: # for Zope3 and Zope 2.9 |
---|
| 24 | from zope.i18nmessageid import MessageFactory |
---|
| 25 | except ImportError: |
---|
| 26 | try: # for Zope 2.8 |
---|
| 27 | from zope.i18nmessageid import MessageIDFactory as MessageFactory |
---|
| 28 | except ImportError: |
---|
| 29 | try: # for zope 2.7 |
---|
| 30 | from Products.PlacelessTranslationService.MessageID import MessageIDFactory as MessageFactory |
---|
| 31 | except: |
---|
| 32 | logging.info("[qPloneCaptchas] No i18n Message Factory found -> cannot provide translations!") |
---|
| 33 | return MessageFactory(projectname.lower()) |
---|
| 34 | |
---|
| 35 | ProductMessageFactory = MessageFactory('%s' % config.PRODUCT_NAME) |
---|
| 36 | ModuleSecurityInfo('Products.%s' % config.PRODUCT_NAME).declarePublic("ProductMessageFactory") |
---|