Ejemplo n.º 1
0
    def reindex_all(self, action):
        context = Acquisition.aq_inner(self.context)

        def _setter(ob, *args, **kw):
            ob.reindexObject()

        status = IStatusMessage(self.request)
        status.addStatusMessage(_(u"Reindex object"), type='info')

        info, warnings, errors = utils.exec_for_all_langs(context, _setter)

        self.handle_status(status, info, warnings, errors)
Ejemplo n.º 2
0
    def set_description(self, action):
        status = IStatusMessage(self.request)
        status.addStatusMessage(_(u"Set text as description"), type="info")
        context = Acquisition.aq_inner(self.context)
        data, error = self.extractData()

        info, warnings, errors = utils.exec_for_all_langs(
            context,
            utils.set_po_description,
            text=data.get('text', ''),
            po_domain=data.get('po_domain', ''))

        self.handle_status(status, info, warnings, errors)
Ejemplo n.º 3
0
    def remove_interface(self, action):
        data, error = self.extractData()
        interface_to_remove = data.get('interface_to_remove')
        status = IStatusMessage(self.request)
        status.addStatusMessage(_(
            u"Remove marker interface '%s' on this object and all "
            u"translations" % interface_to_remove), type="info")
        context = Acquisition.aq_inner(self.context)

        info, warnings, errors = utils.exec_for_all_langs(
            context,
            utils.remove_interface,
            interface_to_remove=interface_to_remove,)

        self.handle_status(status, info, warnings, errors)
Ejemplo n.º 4
0
    def do_action(self, action):
        data, error = self.extractData()
        transition = data.get('transition')
        status = IStatusMessage(self.request)
        status.addStatusMessage(_(
            u"Perform workflow-action '%s' on this object and all "
            u"translations" % transition),
            type="info")
        context = Acquisition.aq_inner(self.context)

        info, warnings, errors = utils.exec_for_all_langs(
            context,
            utils.workflow_action,
            transition=transition,)

        self.handle_status(status, info, warnings, errors)
Ejemplo n.º 5
0
    def cut_and_paste(self, action):
        context = Acquisition.aq_inner(self.context)
        data, error = self.extractData()
        target_path = data.get('target_path', '')
        id_to_move = data.get('id_to_move', '')
        status = IStatusMessage(self.request)
        status.addStatusMessage(_(u"Move object %s to %s" % (
            id_to_move, target_path)), type="info")

        info, warnings, errors = utils.exec_for_all_langs(
            context,
            utils.cut_and_paste,
            target_path=target_path,
            id_to_move=id_to_move,
            target_id=id_to_move)
        self.handle_status(status, info, warnings, errors)
Ejemplo n.º 6
0
    def set_title(self, action):
        status = IStatusMessage(self.request)
        status.addStatusMessage(_(u"Set text as title"), type="info")
        context = Acquisition.aq_inner(self.context)
        data, error = self.extractData()

        info, warnings, errors = utils.exec_for_all_langs(
            context,
            utils.set_po_title,
            text=data.get('text', ''),
            po_domain=data.get('po_domain', ''))

        for msg in info:
            status.addStatusMessage(msg, type='info')
        for msg in warnings:
            status.addStatusMessage(msg, type='warning')
        for msg in errors:
            status.addStatusMessage(msg, type='error')

        self.request.response.redirect(self.context.REQUEST.get('URL'))