diff tincan.py @ 36:4ed261056057 draft header-includes

Put old newline logic back.
author David Barts <n5jrn@me.com>
date Tue, 28 May 2019 15:54:47 -0700
parents 41da0b3d2156
children ce67eac10fc7
line wrap: on
line diff
--- a/tincan.py	Tue May 28 15:49:59 2019 -0700
+++ b/tincan.py	Tue May 28 15:54:47 2019 -0700
@@ -118,6 +118,7 @@
         if line.startswith(self._END) and (len(line) == self._LEND or line[self._LEND] in self._WS):
             self._state = self._body
         self._hbuf.append(line)
+        self._bbuf.append("\n")
 
     def _body(self, line):
         self._bbuf.append(line)
@@ -396,7 +397,7 @@
             obj.handle()
             tvars = self._loads.copy()
             tvars.update(obj.export())
-            return self._template.render(tvars)
+            return self._template.render(tvars).lstrip('\n')
         except bottle.HTTPResponse as e:
             return e
         except Exception as e:
@@ -640,7 +641,7 @@
             obj.handle()
             tvars = self._loads.copy()
             tvars.update(obj.export())
-            return self._body.render(tvars)
+            return self._body.render(tvars).lstrip('\n')
         except ForwardException as fwd:
             target = fwd.target
         except bottle.HTTPResponse as e: