plone.protect/master: Fix logging to no longer write to stdout.

Jonas Baumann <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: plone.protect
Branch: refs/heads/master
Date: 2017-07-03T19:12:19+02:00
Author: Jonas Baumann (jone) <[email protected]>
Commit: https://github.com/plone/plone.protect/commit/eccfe10734576f1043e55d19d8bfe4739aa3a5be

Fix logging to no longer write to stdout.

The `print_stack()` function does actually print the stack (to stdout),
not return it.
What we want to do here is use `format_stack` so that we can include the
stack in the message.

Files changed:
M CHANGES.rst
M plone/protect/auto.py

diff --git a/CHANGES.rst b/CHANGES.rst
index c7fd472..af2d932 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -14,7 +14,9 @@ New features:
 
 Bug fixes:
 
-- *add item here*
+- Fix logging to no longer write traceback to stdout, but include it in the
+  logging message instead.
+  [jone]
 
 
 3.0.24 (2017-07-03)
diff --git a/plone/protect/auto.py b/plone/protect/auto.py
index 445aaaf..78e7f20 100644
--- a/plone/protect/auto.py
+++ b/plone/protect/auto.py
@@ -276,7 +276,7 @@ def _check(self):
                     logger.info(
                         '{0:s}\naborting transaction due to no CSRF '
                         'protection on url {1:s}'.format(
-                            traceback.print_stack(),
+                            '\n'.join(traceback.format_stack()),
                             self.request.URL
                         )
                     )



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.