source: products/SimpleBlog/branches/optimizations/__init__.py

Last change on this file was 1, checked in by myroslav, 18 years ago

Building directory structure

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1from Globals import package_home
2from Products.Archetypes.public import process_types, listTypes
3from Products.CMFCore import utils
4from Products.CMFCore.DirectoryView import registerDirectory
5import os, os.path, sys, content
6
7from Products.CMFCore.utils import ContentInit
8from Products.CMFCore.utils import ToolInit
9
10from config import SKINS_DIR, GLOBALS, PROJECTNAME
11
12from Globals import InitializeClass
13
14registerDirectory(SKINS_DIR, GLOBALS)
15
16from 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
22sys.modules['Products.SimpleBlog.Blog'] = content.blog
23sys.modules['Products.SimpleBlog.BlogEntry'] = content.blogentry
24sys.modules['Products.SimpleBlog.BlogFolder'] = content.blogfolder
25sys.modules['Products.SimpleBlog.TrackBack'] = content.trackback
26
27def 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   
Note: See TracBrowser for help on using the repository browser.