Example #1
0
    def execute (self, params, content):
        params_dict = Command.parseParams (params)

        children = self.parser.page.children
        self._sortChildren (children, params_dict)

        return SimpleView.make (children, self.parser, params)
Example #2
0
    def execute (self, params, content):
        params_dict = Command.parseParams (params)
        attach = Attachment (self.parser.page)

        attachlist = attach.getAttachRelative ()
        attachpath = attach.getAttachPath()

        (dirs, files) = self.separateDirFiles (attachlist, attachpath)

        self._sortFiles (dirs, params_dict)
        self._sortFiles (files, params_dict)

        return SimpleView.make (dirs + files, attachpath)
Example #3
0
    def execute (self, params, content):
        """
        Запустить команду на выполнение. 
        Метод возвращает текст, который будет вставлен на место команды в вики-нотации
        """
        (path, params_tail) = self._getAttach (params)
        if path == None:
            return u""

        params_dict = Command.parseParams (params_tail)
        encoding = self._getEncoding (params_dict)

        try:
            with open (path) as fp:
                # Почему-то в конце всегда оказывается перевод строки
                text = unicode (fp.read (), encoding).rstrip()
        except IOError:
            return _(u"<b>Can't open file %s</b>" % path)
        except:
            return _(u"<b>Encoding error in file %s</b>" % os.path.basename (path) )

        return self._postprocessText (text, params_dict)