Copie depuis le svn du cri à l'état :
[Plinn.git] / __init__.py
1 # -*- coding: utf-8 -*-
2 #######################################################################################
3 # Plinn - http://plinn.org #
4 # Copyright (C) 2005-2007 Benoît PIN <benoit.pin@ensmp.fr> #
5 # #
6 # This program is free software; you can redistribute it and/or #
7 # modify it under the terms of the GNU General Public License #
8 # as published by the Free Software Foundation; either version 2 #
9 # of the License, or (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program; if not, write to the Free Software #
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #
19 #######################################################################################
20 """ Plinn implementation of CMFCore.
21
22 $Id: __init__.py 1530 2009-07-08 09:19:39Z pin $
23 $URL: http://svn.cri.ensmp.fr/svn/Plinn/branches/CMF-2.1/__init__.py $
24 """
25
26 import exceptions
27
28 from Products.CMFCore import utils as core_cmf_utils
29 from Products.CMFDefault import utils as default_cmf_utils
30 from Products.CMFCore.permissions import AddPortalContent
31 import File, Folder, HugePlinnFolder, Topic
32 import MembershipTool
33 import MemberDataTool
34 import GroupsTool
35 import GroupDataTool
36 import RegistrationTool
37 import CalendarTool
38 import AttachmentTool
39 #from shutdown_dispatcher import ZopeShutdownDispatcher
40
41 from PloneMisc import IndexIterator, Batch
42 from utils import getCPInfo, popCP
43
44 import patch
45
46 from AccessControl import allow_module, allow_class
47
48
49 contentClasses = (File.File, Folder.PlinnFolder, HugePlinnFolder.HugePlinnFolder, Topic.Topic )
50
51 contentConstructors = (File.addFile, Folder.manage_addPlinnFolder, HugePlinnFolder.manage_addHugePlinnFolder, Topic.addTopic)
52
53 tools = ( MembershipTool.MembershipTool
54 , MemberDataTool.MemberDataTool
55 , GroupsTool.GroupsTool
56 , GroupDataTool.GroupDataTool
57 , RegistrationTool.RegistrationTool
58 , CalendarTool.CalendarTool
59 , AttachmentTool.AttachmentTool
60 )
61
62 methods = {
63 'getCPInfo': getCPInfo,
64 'getCPInfo__roles__': None,
65 'popCP' : popCP,
66 'popCP__roles__' : None
67 }
68
69 def initialize(registrar) :
70
71 allow_module('quopri')
72 allow_module('Products.Plinn.PloneMisc')
73 allow_class(IndexIterator)
74 allow_class(Batch)
75 app = registrar._ProductContext__app
76 #ZopeShutdownDispatcher(registrar._ProductContext__app)
77
78 core_cmf_utils.ContentInit(
79 'Plinn',
80 content_types = contentClasses,
81 permission = AddPortalContent,
82 extra_constructors = contentConstructors,
83 ).initialize(registrar)
84
85 core_cmf_utils.ToolInit('Plinn Tool',
86 tools = tools,
87 icon = 'tool.gif'
88 ).initialize(registrar)
89
90
91
92
93 # Monkey...
94 # all tags are good !
95 validTags = default_cmf_utils.NASTY_TAGS.copy()
96 for tag in validTags.keys() :
97 validTags[tag] = 1
98
99 VALID_TAGS = {'font': 1}
100
101 validTags.update(VALID_TAGS)
102
103 default_cmf_utils.NASTY_TAGS = {}
104 default_cmf_utils.VALID_TAGS.update(validTags)
105
106 # the plinn portal_calendar is a also a "SPECIAL PROVIDER"
107 import Products.CMFCore.exportimport.actions
108 Products.CMFCore.exportimport.actions._SPECIAL_PROVIDERS += ('portal_calendar',)