_finishConsrtuction a disparu => les slots ne sont plus construits. On assure donc...
[MosaicDocument.git] / __init__.py
1 # -*- coding: utf-8 -*-
2 # (c) 2003 Centre de Recherche en Informatique ENSMP Fontainebleau <http://cri.ensmp.fr>
3 # (c) 2003 BenoƮt PIN <mailto:pin@cri.ensmp.fr>
4
5 from Products.CMFCore.DirectoryView import registerDirectory
6 from Products.CMFCore import utils
7 from Products.CMFCore.permissions import AddPortalContent, ManagePortal
8
9
10 import MosaicDocument
11 import MosaicBlock
12 import ImageSlot, StringSlot, FileSlot, SpacerSlot
13
14 import MosaicTool
15 from MosaicBlockInformation import \
16 MosaicBlockInformation, addMosaicBlockInformationForm, addMosaicBlockInformation, \
17 SlotInfo, addSlotInfo, \
18 RuleInfo, addRuleInfo
19
20 contentClasses = (
21 MosaicDocument.MosaicDocument,
22 MosaicBlock.MosaicBlock,
23 ImageSlot.ImageSlot,
24 StringSlot.StringSlot,
25 FileSlot.FileSlot,
26 SpacerSlot.SpacerSlot
27 )
28
29 contentConstructors = (
30 MosaicDocument.addMosaicDocument,
31 MosaicBlock.addMosaicBlock,
32 ImageSlot.addImageSlot,
33 StringSlot.addStringSlot,
34 FileSlot.addFileSlot,
35 SpacerSlot.addSpacerSlot
36 )
37
38 fti = (
39 MosaicDocument.factory_type_information +
40 ImageSlot.factory_type_information +
41 StringSlot.factory_type_information +
42 FileSlot.factory_type_information +
43 SpacerSlot.factory_type_information +
44 ()
45 )
46
47 for path in ('default_blocks', 'default_slots', 'skins') :
48 registerDirectory(path, globals())
49
50 def initialize(registrar) :
51 utils.ContentInit(
52 'Mosaic Document',
53 content_types = contentClasses,
54 permission = AddPortalContent,
55 extra_constructors = contentConstructors,
56 fti = fti,
57 ).initialize(registrar)
58
59 utils.ToolInit(
60 'Mosaic Tool',
61 tools = (MosaicTool.MosaicTool, ),
62 icon = 'tool.gif',
63 ).initialize(registrar)
64
65 registrar.registerClass(
66 MosaicBlockInformation,
67 constructors = (addMosaicBlockInformationForm, addMosaicBlockInformation),
68 icon = 'dtml/block_icon.gif')
69
70 registrar.registerClass(
71 SlotInfo,
72 constructors=(addSlotInfo,)
73 )
74
75 registrar.registerClass(
76 RuleInfo,
77 constructors=(addRuleInfo,)
78 )
79
80
81 ## monkey patching ZPublisher.Converters
82 from ZPublisher.Converters import type_converters
83 type_converters.update({'expr' : MosaicDocument.Expression})