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, sys, content |
---|
6 | |
---|
7 | from Products.CMFCore.utils import ContentInit |
---|
8 | from Products.CMFCore.utils import ToolInit |
---|
9 | |
---|
10 | from config import SKINS_DIR, GLOBALS, PROJECTNAME |
---|
11 | |
---|
12 | from Globals import InitializeClass |
---|
13 | |
---|
14 | registerDirectory(SKINS_DIR, GLOBALS) |
---|
15 | |
---|
16 | from Products.SimpleBlog.Permissions import wireAddPermissions |
---|
17 | |
---|
18 | # Module aliases - we don't always get it right on the first try, but and we |
---|
19 | # can't move modules around because things are stored in the ZODB with the |
---|
20 | # full module path. However, we can create aliases for backwards compatability. |
---|
21 | |
---|
22 | sys.modules['Products.SimpleBlog.Blog'] = content.blog |
---|
23 | sys.modules['Products.SimpleBlog.BlogEntry'] = content.blogentry |
---|
24 | sys.modules['Products.SimpleBlog.BlogFolder'] = content.blogfolder |
---|
25 | sys.modules['Products.SimpleBlog.TrackBack'] = content.trackback |
---|
26 | |
---|
27 | def initialize(context): |
---|
28 | |
---|
29 | ## Allow module utils |
---|
30 | from AccessControl import ModuleSecurityInfo, allow_module |
---|
31 | ModuleSecurityInfo('Products.SimpleBlog.util').declarePublic('addTrackBack') |
---|
32 | ModuleSecurityInfo('Products.SimpleBlog.util').declarePublic('encodeURLData') |
---|
33 | |
---|
34 | from content import BlogEntry |
---|
35 | from content import Blog |
---|
36 | from content import BlogFolder |
---|
37 | from content import TrackBack |
---|
38 | |
---|
39 | |
---|
40 | listOfTypes = listTypes(PROJECTNAME) |
---|
41 | |
---|
42 | content_types, constructors, ftis = process_types( |
---|
43 | listOfTypes, |
---|
44 | PROJECTNAME) |
---|
45 | |
---|
46 | from Products.SimpleBlog.Permissions import permissions |
---|
47 | |
---|
48 | allTypes = zip(content_types, constructors) |
---|
49 | wireAddPermissions() |
---|
50 | for atype, constructor in allTypes: |
---|
51 | kind = "%s: %s" % (PROJECTNAME, atype.archetype_name) |
---|
52 | ContentInit( |
---|
53 | kind, |
---|
54 | content_types = (atype,), |
---|
55 | permission = permissions[atype.portal_type], |
---|
56 | extra_constructors = (constructor,), |
---|
57 | fti = ftis, |
---|
58 | ).initialize(context) |
---|
59 | |
---|
60 | |
---|
61 | from SimpleBlogTool import SimpleBlogManager |
---|
62 | utils.ToolInit( |
---|
63 | 'SimpleBlog manager', |
---|
64 | tools=(SimpleBlogTool.SimpleBlogManager,), |
---|
65 | product_name='SimpleBlog', |
---|
66 | icon='tool.gif', ).initialize(context) |
---|
67 | |
---|
68 | |
---|
69 | |
---|