py_ext/PythonFileCTNMixin.py
changeset 1118 2c96a2f36295
parent 1113 16e5b6abd91c
child 1120 35d772ec1a76
--- 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"