예제 #1
0
    def update(self):
        self.registry = getUtility(IRegistry)

        self.settings = Settings(self.context)
        self.global_settings = self.registry.forInterface(IStreamingSettings)
        self.site = getPortal(self.context)

        self.portal_url = getMultiAdapter((self.context, self.request),
            name="plone_portal_state").portal_url()

        utils = getToolByName(self.context, 'plone_utils')
        msg = None

        if self.settings.converting is not None and \
                self.settings.converting:
            msg = "O arquivo está sendo convertido."
            self.enabled = False
        elif self.settings.successfully_converted is not None and \
                not self.settings.successfully_converted:
            msg = "Ocorreu um erro ao converter o arquivo. " +\
                  "Talvez o arquivo esteja corrombido ou é mal formatado." +\
                  "Cheque o log para ter mais detalhes."
            self.enabled = False
        elif self.settings.successfully_converted is None:
            # must have just switched to this view
            msg = "This document is not yet converted to document Este documento ainda não foi convertido. Por favor clique na aba `Conversor Multimídia` " +\
                  "para fazer a conversão."
            self.enabled = False

        mtool = getToolByName(self.context, 'portal_membership')
        self.can_modify = mtool.checkPermission('cmf.ModifyPortalContent',
                                                self.context)
        if msg and self.can_modify:
            utils.addPortalMessage(msg)
예제 #2
0
 def __init__(self, object):
     self.object = object
     self.objectpath = self.object.getPhysicalPath()
     self.portal = getPortal(object)
     self.portalpath = self.portal.getPhysicalPath()
     self.async = getUtility(IAsyncService)
     self.queue = self.async.getQueues()[""]