[damned-lies] Catch OSError in QualityCheckView



commit e2333329252716834018dc82f21db9aa0bd3c9ed
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Jun 10 11:02:24 2021 +0200

    Catch OSError in QualityCheckView

 vertimus/views.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/vertimus/views.py b/vertimus/views.py
index 0c6a1d00..0ca3f99e 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -296,7 +296,10 @@ class QualityCheckView(PoFileActionBase):
             context['results'] = _('No po file to check')
         else:
             context['checks'] = ['xmltags']
-            results = check_po_quality(self.pofile, context['checks'])
+            try:
+                results = check_po_quality(self.pofile, context['checks'])
+            except OSError as err:
+                context['results'] = 'Sorry, the server was not able to run the quality checks on this file 
(%s)' % err
             if results:
                 context['results'] = mark_safe(re.sub(
                     r'^(# \(pofilter\) .*)', r'<span class="highlight">\1</span>', escape(results), 
flags=re.M


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]