Mercurial > libervia-web
comparison libervia/server/pages.py @ 1208:584e29d9510a
pages: display a warning instead or raising exception if write fails:
request.write sometimes raise an AttributeError.
This case happens most of time when browser tab is closed or reloaded before the page has
been written.
fix 214
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 19 Jul 2019 18:01:38 +0200 |
parents | 92d0a2b785fd |
children | b2d067339de3 |
comparison
equal
deleted
inserted
replaced
1207:67ec22356457 | 1208:584e29d9510a |
---|---|
1195 log.debug(_(u"{page} put in cache for [{profile}]") | 1195 log.debug(_(u"{page} put in cache for [{profile}]") |
1196 .format( page=self, profile=self._do_cache[0])) | 1196 .format( page=self, profile=self._do_cache[0])) |
1197 self._do_cache = None | 1197 self._do_cache = None |
1198 self._checkCacheHeaders(request, page_cache) | 1198 self._checkCacheHeaders(request, page_cache) |
1199 | 1199 |
1200 request.write(data_encoded) | 1200 try: |
1201 request.write(data_encoded) | |
1202 except AttributeError: | |
1203 log.warning(_(u"Can't write page, the request has probably been cancelled " | |
1204 u"(browser tab closed or reloaded)")) | |
1205 return | |
1201 request.finish() | 1206 request.finish() |
1202 | 1207 |
1203 def _subpagesHandler(self, __, request): | 1208 def _subpagesHandler(self, __, request): |
1204 """render subpage if suitable | 1209 """render subpage if suitable |
1205 | 1210 |