Author: remi
Date: 2008-09-17 18:04:14 +0200 (Wed, 17 Sep 2008)
New Revision: 1886

Modified:
   software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py
Log:
* added a "special resources" exclusion list when the resources are launched.

Modified: software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py
===================================================================
--- software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py  
2008-09-17 15:21:05 UTC (rev 1885)
+++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py  
2008-09-17 16:04:14 UTC (rev 1886)
@@ -64,6 +64,11 @@
         print self.__versionStr
         # Get the server port
         self.__port = port
+        # Open the logger
+        self.__logger = SimpleLogger("httpserver")
+        self.__logger.resetLog()
+        self.__logger.setLevel(LOG_LEVEL_DEBUG)
+        self.__logger.setTarget(LOG_TARGET_BOTH)
         # Load libtuxdriver and libtuxosl
         self.__tuxOSL = TuxOSL()
         self.__tuxDrv = TuxDrv()
@@ -170,15 +175,32 @@
         Glb_TuxOSL = self.__tuxOSL
         Glb_TuxDrv = self.__tuxDrv
         Glb_Version = self.__versionStr
+        
+        # Special resources
+        sResourceList = [
+            "ResourceParent.py",
+        ]
 
         # Load the resources from the external files
         resourceList = os.listdir('%s/resources' % APPLICATION_PATH)
         for resource in resourceList:
+            if resource in sResourceList:
+                continue
             if resource.lower().rfind(".py") != -1:
                 resourceFile = os.path.join(APPLICATION_PATH, 'resources', 
resource)
-                str = open(resourceFile, 'r').read()
-                exec(str) in globals()
+                try:
+                    str = open(resourceFile, 'r').read()
+                    exec(str) in globals()
+                except:
+                    self.__logger.logError("Error in the resource file [%s]")
+                    self.__logger.logError(sys.exec_info())
         
+        # Load and execute "ResourceParent.py" 
+        # This resource must be always loaded and executed in last position 
!!!!
+        resourceFile = os.path.join(APPLICATION_PATH, 'resources', 
"ResourceParent.py")
+        str = open(resourceFile, 'r').read()
+        exec(str) in globals()
+        
 def run():
     """Run the server
     """


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to