source: products/qPloneCaptchas/tags/1.2.2/__init__.py @ 2284

Last change on this file since 2284 was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1from Products.CMFCore.DirectoryView import registerDirectory
2from App.version_txt import getZopeVersion
3from Products.CMFCore.utils import ToolInit
4import logging
5from AccessControl import allow_module, ModuleSecurityInfo
6import config
7import CaptchaTool
8
9allow_module('Products.qPloneCaptchas.utils')
10allow_module('Products.qPloneCaptchas.config')
11registerDirectory('skins', config.GLOBALS)
12
13tools = (CaptchaTool.CaptchaTool, )
14def initialize(context):
15    ToolInit(meta_type="CaptchaTool",
16             tools=tools,
17             product_name=config.PRODUCT_NAME,
18             icon=config.TOOL_ICON,).initialize(context)
19
20def MessageFactory(projectname):
21    "Get a i18n message factory"
22    vmajor, vminor, vmicro, vstatus, vrelease = getZopeVersion()
23    MessageFactory = lambda : "no message factory found"
24    if (vmajor > 2) or ((vmajor, vminor) == (2,9)):
25        from zope.i18nmessageid import MessageFactory
26    elif (vmajor, vminor) == (2,8):
27        from zope.i18nmessageid import MessageIDFactory as MessageFactory
28    else:
29        try:
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
35ProductMessageFactory = MessageFactory('%s' % config.PRODUCT_NAME)
36ModuleSecurityInfo('Products.%s' % config.PRODUCT_NAME).declarePublic("ProductMessageFactory")
Note: See TracBrowser for help on using the repository browser.