source: WAeUP_SRP/base/__init__.py @ 3677

Last change on this file since 3677 was 3673, checked in by jens, 16 years ago
  • unclutter package by moving all patch files into a dedicated subfolder and importing it.
  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1#-*- mode: python; mode: fold -*-
2# $Id: __init__.py 3673 2008-09-16 14:59:16Z jens $
3from Products.CMFCore.utils import ContentInit, ToolInit
4from Products.CMFCore.DirectoryView import registerDirectory
5from Products.CMFCore import utils as cmfutils
6from Products.CMFCore.permissions import AddPortalContent
7
8from Products.GenericSetup import profile_registry
9from Products.GenericSetup import EXTENSION
10
11from Products.CPSCore.interfaces import ICPSSite
12from Products.CPSDirectory.DirectoryTool import DirectoryTypeRegistry
13
14import patches
15
16import Products.WAeUP_SRP.WAeUPPermissions
17import WAeUPTool
18
19import Widgets
20tools = (WAeUPTool.WAeUPTool,)
21
22waeup_types = (
23    ("University",('University',)),
24    ("Academics",
25       ("AcademicsFolder",
26        "Certificate",
27        "CertificateCourse",
28        "Faculty",
29        "Department",
30        "Course",
31        "CertificateCourse",
32        "StudyLevel",
33        )
34     ),
35     ("Accommodation",
36        ("AccoFolder",
37         "AccoHall",
38         )
39     ),
40     ("Payment",
41        ("PaymentsFolder",
42         "Payment",
43         )
44     ),
45     ("Students",
46        ("StudentsFolder",
47         "Student",
48         "StudentAccommodation",
49         "StudentStudyCourse",
50         "StudentCourseResult",
51         "StudentApplication",
52         "StudentPume",
53         "StudentClearance",
54         "StudentPersonal",
55         "StudentStudyLevel",
56         #"Semester",
57         "StudentCourseResult",
58         # move to Academics later
59         #"Semester",
60         )
61      ),
62     ("ScratchCards",
63         ("ScratchCardBatch",
64          "ScratchCardBatchesFolder",
65         )
66     ),
67     ("Documents",
68        ("DocumentsFolder",
69         "WAeUPDocument",
70        )
71     ),
72     ("Upload",
73        ("UploadsFolder",
74         "Upload",
75         )
76     ),
77    )
78
79contentClasses = []
80cc = []
81for modu,names in waeup_types:
82    mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(),
83                globals(),
84                locals(),
85                ['*',]
86                )
87    for name in names:
88        #print name
89        contentClasses.append(getattr(mod,name))
90        cc.append(getattr(mod,"add%(name)s" % vars()))
91contentConstructors = tuple(cc)
92
93fti = [{} for t in range(len(contentConstructors))]
94
95registerDirectory('skins', globals())
96
97def initialize(registrar):
98    ToolInit('WAeUP Tool',
99              tools=tools,
100              icon='tool.gif',
101              ).initialize(registrar)
102    ContentInit('WAeUP Types',
103                content_types = contentClasses,
104                permission = AddPortalContent,
105                extra_constructors = contentConstructors,
106                fti = fti,
107                ).initialize(registrar)
108
109    # Extension profile registration
110    profile_registry.registerProfile(
111        'default',
112        'WAeUP_SRP',
113        "The WestAfrican e-University Project",
114        'profiles/default',
115        'WAeUP_SRP',
116        EXTENSION,
117        for_=ICPSSite)
118##    DirectoryTypeRegistry.register(WAeUPTables.Applicants)
119
120    # Create a faster session container in temp_folder...
121    import Zope
122    from Products.faster.sessiondata import addSessionDataContainer
123    sess_container_name = "faster_session"
124    root = Zope.app()
125    temp = root.unrestrictedTraverse( "/temp_folder", None )
126    if temp is not None and not sess_container_name in temp.objectIds():
127        addSessionDataContainer( temp, sess_container_name, 9600, 4800,
128                  lazy=True, title='Faster session data container')
129
Note: See TracBrowser for help on using the repository browser.