# HG changeset patch
# User Laurent Bessard
# Date 1368184046 -7200
# Node ID 2c96a2f3629596831e0d0b1e7494aeca5b27e9a0
# Parent  1aef6a7db08d9b7c7a7210b2889f942f19b6ec5d
Fixed generated code in py_ext runtime file

diff -r 1aef6a7db08d -r 2c96a2f36295 py_ext/PythonFileCTNMixin.py
--- a/py_ext/PythonFileCTNMixin.py	Fri May 10 13:06:47 2013 +0200
+++ b/py_ext/PythonFileCTNMixin.py	Fri May 10 13:07:26 2013 +0200
@@ -48,7 +48,7 @@
         
         # Adding includes
         text += "## User includes\n"
-        text += self.CodeFile.includes.gettext()
+        text += self.CodeFile.includes.gettext().strip()
         text += "\n"
         
         # Adding variables
@@ -65,7 +65,7 @@
         
         # Adding user global variables and routines
         text += "## User internal user variables and routines\n"
-        text += self.CodeFile.globals.gettext()
+        text += self.CodeFile.globals.gettext().strip()
         text += "\n"
         
         # Adding Beremiz confnode functions
@@ -78,10 +78,13 @@
             ("__publish_", "", "", self.CodeFile.publishFunction),]:
             text += "def %s%s(%s):\n" % (func, location_str, args)
             lines = code_object.gettext().strip().splitlines()
+            print lines
             if len(lines) > 0 or return_code != "":
                 for line in lines:
                     text += "    " + line + "\n"
-                text += "    " + return_code + "\n\n"
+                if return_code != "":
+                    text += "    " + return_code + "\n"
+                text += "\n"
             else:
                 text += "    pass\n\n"