comparison MoinMoin/wikimacro.py @ 53:699811601bed

merge moin--main--1.3--patch-934,935: detect correctly missing plguins and missing names in plugins Patches applied: * arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-934 detect correctly missing plguins and missing names in plugins * arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-935 updated CHANGES * nirs@freeshell.org--2005/moin--fix--1.3--patch-60 detect correctly missing plguins and missing names in plugins imported from: moin--main--1.5--patch-54
author Nir Soffer <nirs@freeshell.org>
date Thu, 29 Sep 2005 00:50:30 +0000
parents 54d5932d5a03
children e51cb51522d1
comparison
equal deleted inserted replaced
52:80b3d4e891ff 53:699811601bed
106 macro, or just raise ImportError. 106 macro, or just raise ImportError.
107 """ 107 """
108 self.name = macro_name 108 self.name = macro_name
109 try: 109 try:
110 execute = wikiutil.importPlugin(self.cfg, 'macro', macro_name) 110 execute = wikiutil.importPlugin(self.cfg, 'macro', macro_name)
111 except ImportError: 111 except wikiutil.PluginMissingError:
112 try: 112 try:
113 builtins = self.__class__ 113 builtins = self.__class__
114 execute = getattr(builtins, '_macro_' + macro_name) 114 execute = getattr(builtins, '_macro_' + macro_name)
115 except AttributeError: 115 except AttributeError:
116 if macro_name in i18n.languages: 116 if macro_name in i18n.languages:
117 execute = builtins._m_lang 117 execute = builtins._m_lang
118 else: 118 else:
119 raise ImportError("Cannot load macro %s" % macro_name) 119 raise ImportError("Cannot load macro %s" % macro_name)
120 return execute(self, args) 120 return execute(self, args)
121 121
122 def _m_lang(self, text): 122 def _m_lang(self, text):
123 """ Set the current language for page content. 123 """ Set the current language for page content.
124 124
138 if macro_name in self.Dependencies: 138 if macro_name in self.Dependencies:
139 return self.Dependencies[macro_name] 139 return self.Dependencies[macro_name]
140 try: 140 try:
141 return wikiutil.importPlugin(self.request.cfg, 'macro', 141 return wikiutil.importPlugin(self.request.cfg, 'macro',
142 macro_name, 'Dependencies') 142 macro_name, 'Dependencies')
143 except (ImportError, AttributeError): 143 except wikiutil.PluginError:
144 return self.defaultDependency 144 return self.defaultDependency
145 145
146 def _macro_TitleSearch(self, args): 146 def _macro_TitleSearch(self, args):
147 return self._m_search("titlesearch") 147 return self._m_search("titlesearch")
148 148