Closed lukasgraf closed 9 years ago
The handling for redirects introduced in @6348b574 leads to this traceback when a redirect is encountered:
2015-11-02 11:58:49 ERROR plone.transformchain Unexpected error whilst trying to apply transform chain Traceback (most recent call last): File "/Users/lukasgraf/Plone/eggs/plone.transformchain-1.0.4-py2.7.egg/plone/transformchain/transformer.py", line 48, in __call__ newResult = handler.transformIterable(result, encoding) File "/Users/lukasgraf/Plone/buildouts/plone/plone4/src/plone.protect/plone/protect/auto.py", line 163, in transformIterable return self.transform(result, encoding) File "/Users/lukasgraf/Plone/buildouts/plone/plone4/src/plone.protect/plone/protect/auto.py", line 267, in transform root = result.tree.getroot() AttributeError: 'list' object has no attribute 'tree'
This is because ProtectTransform.parseTree() returns result unchanged, which may be a list or a string.
ProtectTransform.parseTree()
result
But ProtectTransform.transform() expects it to be either None or an XMLSerializer object.
ProtectTransform.transform()
None
XMLSerializer
Returning None instead from parseTree() for redirects would be the proper thing to do IMHO. This should cause transform() to also return None, indicating that no transformation should be done.
parseTree()
transform()
Tested on Plone 4.3.7 + plone4.csrffixes.
plone4.csrffixes
@gforcada @vangheem
@lukasgraf thanks for the fix, it's weird though that I never actually saw this traceback...
The handling for redirects introduced in @6348b574 leads to this traceback when a redirect is encountered:
This is because
ProtectTransform.parseTree()
returnsresult
unchanged, which may be a list or a string.But
ProtectTransform.transform()
expects it to be eitherNone
or anXMLSerializer
object.Returning
None
instead fromparseTree()
for redirects would be the proper thing to do IMHO. This should causetransform()
to also returnNone
, indicating that no transformation should be done.Tested on Plone 4.3.7 +
plone4.csrffixes
.@gforcada @vangheem