예제 #1
0
def add_MetaPublisher2(self, id, title='', presets=[], REQUEST=None):
    """!TXT! MetaPublisher2 Constructor"""

    id = str(id)
    title = str(title)

    instance = MetaPublisher2(id)
    instance.title = title
    id = self._setObject(id, instance)
    metapublisher2 = self._getOb(id)

    add_MetaPublisher2Designs(metapublisher2, 'designs')
    add_MetaPublisher2Frontends(metapublisher2, 'frontends')
    add_MetaPublisher2Languages(metapublisher2, 'languages')
    add_MetaPublisher2Tools(metapublisher2, 'tools')
    add_MetaPublisher2Widgets(metapublisher2, 'widgets')

    if presets:
        raise NotImplemented("!TXT! Preset initialization not yet implemented!")

    if REQUEST is not None:
        try:
            url = self.DestinationURL()
        except:
            url = REQUEST['URL1']
        url = '%s/manage_main?update_menu=1&manage_tabs_message=%s' % (
            url,
            quote_plus('!TXT! New MetaPublisher2 "%s" created.' % id)
        )
        REQUEST.RESPONSE.redirect(url)
예제 #2
0
    def __setstate__(self, state):
        """!TXT! Handle startup event"""

        Folder.inheritedAttribute('__setstate__')(self, state)

        # initialize profiles
        if not hasattr(self, '_Profiles__profiles'):
            self.init_profiles()

        # create missing new folders
        ids = self.objectIds()
        if not 'designs' in ids:
            add_MetaPublisher2Designs(self, 'designs')
        if not 'frontends' in ids:
            add_MetaPublisher2Frontends(self, 'frontends')
        if not 'languages' in ids:
            add_MetaPublisher2Languages(self, 'languages')
        if not 'tools' in ids:
            add_MetaPublisher2Tools(self, 'tools')
        if not 'widgets' in ids:
            add_MetaPublisher2Widgets(self, 'widgets')

        # move frontends from legacy location into frontends folder
        if 'interfaces' in ids and self.interfaces.meta_type == 'InterfacesFolder':
            try:
                if self.interfaces.objectIds():
                    clipboard = self.interfaces.manage_copyObjects(self.interfaces.objectIds())
                    self.frontends.manage_pasteObjects(clipboard)
                self.manage_delObjects('interfaces')
            except:
                pass