[1] | 1 | from Globals import package_home |
---|
| 2 | from Products.Archetypes.public import process_types, listTypes |
---|
| 3 | from Products.CMFCore import utils |
---|
| 4 | from Products.CMFCore.DirectoryView import registerDirectory |
---|
| 5 | import os, os.path |
---|
| 6 | import PingInfo, PingTool |
---|
| 7 | from config import * |
---|
| 8 | |
---|
| 9 | try: |
---|
| 10 | from adapter import registerAdapter |
---|
| 11 | registerAdapter() |
---|
| 12 | except: |
---|
| 13 | from Products.CMFCore.utils import getToolByName |
---|
| 14 | from Products.CMFPlone.URLTool import URLTool |
---|
| 15 | def getCanonicalURL(self): |
---|
| 16 | portal = getToolByName(self, 'portal_url').getPortalObject() |
---|
| 17 | return portal.getProperty('canonical_url', None) |
---|
| 18 | #URLTool.security.declarePublic('getCanonicalURL') |
---|
| 19 | URLTool.getCanonicalURL = getCanonicalURL |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | registerDirectory(SKINS_DIR, GLOBALS) |
---|
| 23 | tools = ( PingTool.PingTool, ) |
---|
| 24 | |
---|
| 25 | def initialize(context): |
---|
| 26 | from AccessControl import allow_module |
---|
| 27 | allow_module('Products.qPingTool.util') |
---|
| 28 | |
---|
| 29 | utils.ToolInit("PingTool", tools=tools, product_name=PROJECTNAME, icon=TOOL_ICON, |
---|
| 30 | ).initialize(context) |
---|
| 31 | |
---|
| 32 | content_types, constructors, ftis = process_types(listTypes(PROJECTNAME), PROJECTNAME) |
---|
| 33 | |
---|
| 34 | utils.ContentInit( |
---|
| 35 | PROJECTNAME + ' Content', |
---|
| 36 | content_types = content_types, |
---|
| 37 | permission = ADD_PERMISSION, |
---|
| 38 | extra_constructors = constructors, |
---|
| 39 | fti = ftis, |
---|
| 40 | ).initialize(context) |
---|
| 41 | |
---|