Esempio n. 1
0
    def _addMethods(self):
        """ Just to have all methods adding something extra
            to the ZMI together """
        file_path = Globals.package_home(globals())

        localizer = Localizer('Localizer', ('en', 'es', 'eu',))
        localizer._v_hook = 1
        self._setObject('Localizer', localizer)

        try:
            # old MessageCatalog
            self._setObject('gettext',
                    MessageCatalog('gettext', '', ('en', 'es', 'eu')))
        except:
            # new MessageCatalog
            self._setObject('gettext',
                    MessageCatalog('gettext', '', 'en', ['en', 'es', 'eu']))

        gettext = getattr(self, 'gettext')
        fillMessageCatalog(gettext)

        # Add a special tag.py script which makes use of traverse subpath
        self._setObject('tag', PythonScript('tag'))
        tag = getattr(self, 'tag')
        f = open(file_path + '/tag.py')
        data = f.read()
        f.close()
        tag.ZPythonScript_edit('', data)

        # Add a feed.xml file with the RSS feed
        addDTML(self, 'feed.xml', '', 'ui/feed.xml')

        # Add the CSS file
        self.manage_addFile('blog.css')
        css = getattr(self, 'blog.css')
        f = open(file_path + '/ui/blog.css')
        data = f.read()
        f.close()
        css.update_data(data)
    def _addMethods(self):
        """ method for adding templates, scripts, ... """

        dtmls = ['blogs_main', 'column', 'create_blog_form',
                 'index_html', 'last_posts']
        dtmls.extend(['logged_in', 'logged_out', 'login_form',
                      'entry_body_community'])
        dtmls.extend(['menu', 'mini_login_form', 'preheader',
                      'default_template'])
        dtmls.extend(['standard_html_footer', 'standard_html_header',
                      'step1', 'step2', 'step3'])
        dtmls.extend(['step3.done', 'tag_all_html', 'tag_html'])
        dtmls.extend(['reminder', 'reminder.done', 'changepass'])
        for dtml in dtmls:
            addDTML(self, dtml, '', 'ui/communityTemplates/%s' % dtml)

        scripts = ['step1.do', 'step2.do', 'step3.do', 'tag',
                   'tagsAndPixels', 'usersBlog', 'logout']
        scripts.extend(['reminder.do', 'changepass.do'])
        for script in scripts:
            addPythonScript(self, script, 'ui/communityTemplates/%s' % script)
            ob = getattr(self, script)
            ob._proxy_roles = ('Manager',)