Esempio n. 1
0
    def _getShortTemplateName(self, template_fname):
        '''
        Convert full template path to short path
        '''
        snippets_dir = getSnippetsDir()
        shortTemplateName = template_fname

        if shortTemplateName.startswith(snippets_dir):
            shortTemplateName = shortTemplateName[len(snippets_dir) + 1:]

        shortTemplateName = shortTemplateName.replace(u'\\', u'/')
        return shortTemplateName
Esempio n. 2
0
    def setUp(self):
        plugins_dir = [u"../plugins/snippets"]

        self.loader = PluginsLoader(Application)
        self.loader.load(plugins_dir)
        self._createWiki()
        self._application = Application

        factory = ParserFactory()
        self.parser = factory.make(self.testPage, self._application.config)

        from snippets.utils import getSnippetsDir
        root_snippets_dir = getSnippetsDir()

        # snippets dir for tests
        self._snippets_dir = os.path.join(
            root_snippets_dir, u'__test_snippets')
        os.mkdir(self._snippets_dir)
Esempio n. 3
0
    def setUp(self):
        plugins_dir = [u"../plugins/snippets"]

        self.loader = PluginsLoader(Application)
        self.loader.load(plugins_dir)
        self._createWiki()
        self._application = Application

        factory = ParserFactory()
        self.parser = factory.make(self.testPage, self._application.config)

        from snippets.utils import getSnippetsDir
        root_snippets_dir = getSnippetsDir()

        # snippets dir for tests
        self._snippets_dir = os.path.join(root_snippets_dir,
                                          u'__test_snippets')
        os.mkdir(self._snippets_dir)
Esempio n. 4
0
    def setUp(self):
        self.initApplication()
        self.wikiroot = self.createWiki()
        self.testPage = WikiPageFactory().create(self.wikiroot, "Страница 1",
                                                 [])
        plugins_dir = ["../plugins/snippets"]

        self.loader = PluginsLoader(self.application)
        self.loader.load(plugins_dir)

        factory = ParserFactory()
        self.parser = factory.make(self.testPage, self.application.config)

        from snippets.utils import getSnippetsDir
        root_snippets_dir = getSnippetsDir()

        # snippets dir for tests
        self._snippets_dir = os.path.join(root_snippets_dir, '__test_snippets')
        os.mkdir(self._snippets_dir)
Esempio n. 5
0
    def setUp(self):
        self.initApplication()
        self.wikiroot = self.createWiki()
        self.testPage = WikiPageFactory().create(self.wikiroot,
                                                 "Страница 1",
                                                 [])
        plugins_dir = ["../plugins/snippets"]

        self.loader = PluginsLoader(self.application)
        self.loader.load(plugins_dir)

        factory = ParserFactory()
        self.parser = factory.make(self.testPage, self.application.config)

        from snippets.utils import getSnippetsDir
        root_snippets_dir = getSnippetsDir()

        # snippets dir for tests
        self._snippets_dir = os.path.join(
            root_snippets_dir, '__test_snippets')
        os.mkdir(self._snippets_dir)
Esempio n. 6
0
 def _updateMenu(self):
     self._removeSnippetsFromMenu()
     sl = SnippetsLoader(getSnippetsDir())
     snippets_tree = sl.getSnippets()
     self._buildTree(snippets_tree, self._menu)
Esempio n. 7
0
 def __onWikiParserPrepare(self, parser):
     """
     Вызывается до разбора викитекста.
     """
     command = CommandSnip(parser, getSnippetsDir(), self._application)
     parser.addCommand(command)
Esempio n. 8
0
 def _updateMenu(self):
     self._removeSnippetsFromMenu()
     sl = SnippetsLoader(getSnippetsDir())
     snippets_tree = sl.getSnippets()
     self._buildTree(snippets_tree, self._menu)
Esempio n. 9
0
 def __onWikiParserPrepare(self, parser):
     """
     Вызывается до разбора викитекста.
     """
     command = CommandSnip(parser, getSnippetsDir(), self._application)
     parser.addCommand(command)