Mercurial > cgi-bin > hgweb.cgi > tincan
comparison 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 |
comparison
equal
deleted
inserted
replaced
35:41da0b3d2156 | 36:4ed261056057 |
---|---|
116 self._state(line) | 116 self._state(line) |
117 return | 117 return |
118 if line.startswith(self._END) and (len(line) == self._LEND or line[self._LEND] in self._WS): | 118 if line.startswith(self._END) and (len(line) == self._LEND or line[self._LEND] in self._WS): |
119 self._state = self._body | 119 self._state = self._body |
120 self._hbuf.append(line) | 120 self._hbuf.append(line) |
121 self._bbuf.append("\n") | |
121 | 122 |
122 def _body(self, line): | 123 def _body(self, line): |
123 self._bbuf.append(line) | 124 self._bbuf.append(line) |
124 | 125 |
125 class TemplateHeader(object): | 126 class TemplateHeader(object): |
394 try: | 395 try: |
395 obj = self._class(bottle.request, e) | 396 obj = self._class(bottle.request, e) |
396 obj.handle() | 397 obj.handle() |
397 tvars = self._loads.copy() | 398 tvars = self._loads.copy() |
398 tvars.update(obj.export()) | 399 tvars.update(obj.export()) |
399 return self._template.render(tvars) | 400 return self._template.render(tvars).lstrip('\n') |
400 except bottle.HTTPResponse as e: | 401 except bottle.HTTPResponse as e: |
401 return e | 402 return e |
402 except Exception as e: | 403 except Exception as e: |
403 traceback.print_exc() | 404 traceback.print_exc() |
404 # Bottle doesn't allow error handlers to themselves cause | 405 # Bottle doesn't allow error handlers to themselves cause |
638 try: | 639 try: |
639 obj = self._class(bottle.request, bottle.response) | 640 obj = self._class(bottle.request, bottle.response) |
640 obj.handle() | 641 obj.handle() |
641 tvars = self._loads.copy() | 642 tvars = self._loads.copy() |
642 tvars.update(obj.export()) | 643 tvars.update(obj.export()) |
643 return self._body.render(tvars) | 644 return self._body.render(tvars).lstrip('\n') |
644 except ForwardException as fwd: | 645 except ForwardException as fwd: |
645 target = fwd.target | 646 target = fwd.target |
646 except bottle.HTTPResponse as e: | 647 except bottle.HTTPResponse as e: |
647 return e | 648 return e |
648 except Exception as e: | 649 except Exception as e: |