[tuxdroid-svn] r4928 - software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugi
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-06-29 09:05:36
|
Author: remi Date: 2009-06-29 11:05:32 +0200 (Mon, 29 Jun 2009) New Revision: 4928 Modified: software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py Log: * more informations on plugin deployment error Modified: software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py =================================================================== --- software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py 2009-06-29 09:04:56 UTC (rev 4927) +++ software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginsContainer.py 2009-06-29 09:05:32 UTC (rev 4928) @@ -6,8 +6,10 @@ # This module is highly inspired by a "gadget framework" written by # "Yoran Brault" <http://artisan.karma-lab.net> +import sys import os import threading +import traceback from util.filesystem.AutoDeployer import AutoDeployer from util.xml.XmlSerializer import XmlSerializer @@ -296,6 +298,21 @@ # ========================================================================== # -------------------------------------------------------------------------- + # Format the last traceback. + # -------------------------------------------------------------------------- + def __formatException(self): + """Format the last traceback. + @return: A string. + """ + fList = traceback.format_exception(sys.exc_info()[0], + sys.exc_info()[1], + sys.exc_info()[2]) + result = "" + for line in fList: + result += line + return result + + # -------------------------------------------------------------------------- # Build a plugin object from a deployed plugin. # -------------------------------------------------------------------------- def __buildPlugin(self, observerName, fileName, pluginPath, pluginName): @@ -310,9 +327,13 @@ """ # Check for "plugin.xml" pluginXmlFile = os.path.join(pluginPath, "resources", "plugin.xml") + if not os.path.isfile(pluginXmlFile): + return None, "'plugin.xml' not found" pluginXmlDict = XmlSerializer.deserializeEx(pluginXmlFile) if pluginXmlDict == None: - return None, "'plugin.xml' not found" + error = "'plugin.xml' XML format error\n" + XmlSerializer.getLastTraceback() + return None, error + #return None, "'plugin.xml' XML format error" # Check for "help.wiki" helpWikiFile = os.path.join(pluginPath, "resources", "help.wiki") if not os.path.isfile(helpWikiFile): @@ -325,7 +346,8 @@ try: plugin = Plugin(self, pluginXmlDict, fileName, pluginPath) except: - return None, "Error in 'plugin.xml'" + error = "Error in 'plugin.xml'\n" + self.__formatException() + return None, error # Check the plugin platform pluginPlatform = plugin.getDescription().getPlatform() if pluginPlatform != "all": |