diff --git a/core/docs/changelog/ZO-859.change b/core/docs/changelog/ZO-859.change new file mode 100644 index 0000000000..204a522ed2 --- /dev/null +++ b/core/docs/changelog/ZO-859.change @@ -0,0 +1 @@ +ZO-859: Log XML body after checkout to aid debugging diff --git a/core/src/zeit/cms/checkout/manager.py b/core/src/zeit/cms/checkout/manager.py index a16cb19dfb..0e323f46c9 100644 --- a/core/src/zeit/cms/checkout/manager.py +++ b/core/src/zeit/cms/checkout/manager.py @@ -1,4 +1,7 @@ +import logging + import grokcore.component as grok +import lxml.etree import pendulum import zope.app.locking.interfaces import zope.cachedescriptors.property @@ -8,6 +11,7 @@ import zope.interface import zope.security.proxy +from zeit.cms.content.interfaces import IXMLRepresentation from zeit.cms.i18n import MessageFactory as _ import zeit.cms.checkout.interfaces import zeit.cms.interfaces @@ -17,6 +21,9 @@ import zeit.objectlog.interfaces +log = logging.getLogger(__name__) + + @zope.component.adapter(zeit.cms.interfaces.ICMSContent) @zope.interface.implementer( zeit.cms.checkout.interfaces.ICheckoutManager, zeit.cms.checkout.interfaces.ICheckinManager @@ -102,6 +109,12 @@ def checkout(self, event=True, temporary=False, publishing=False): ) ) + # XXX Debug helper, see ZO-859 + log_body = config.get('checkout-log-body', '').lower() == 'true' + if log_body and IXMLRepresentation.providedBy(added): + body = lxml.etree.tostring(added.xml, pretty_print=True, encoding=str) + log.info('%s checked out %s:\n%s', self.principal.id, added, body) + return workingcopy[name] @property