Bug in table edit of forms editor

Bug #132492 reported by Benno Luthiger
4
Affects Status Importance Assigned to Milestone
Silva
Fix Released
Medium
Unassigned
Silva Document
Fix Released
Medium
Wim Boucquaert

Bug Description

If the text in a table cell gets decorated, this will make the forms editor throwing an "AttributeError: strip" when the document in placed in a hierarchy somewhere under a folder with the ID 'data'.

Reason:
The problem is caused by the script "SilvaDocument/widgets/element/table_elements/row/render_field.py". On line 25, there's the following condition:
---
    if (len(node.childNodes) == 1 and hasattr(node.childNodes[0], 'data') and
            len(node.childNodes[0].data.strip()) == 0):
---
This condition acquires the object 'data' and calls to strip() method on it. This is correct if 'data' is a field returning a string. However, if hasattr(node.childNodes[0], 'data') acquires a SilvaFolder, the command SilvaFolder.strip() will fail.

Suggested fix:
Use 'node.childNodes[0].aq_explicit instead:
---
    if (len(node.childNodes) == 1 and hasattr(node.childNodes[0].aq_explicit, 'data') and
            len(node.childNodes[0].data.strip()) == 0):
---

Does this solution have any unintended side effects?

Regards,
Benno

Revision history for this message
Benno Luthiger (benno-luthiger) wrote :

Will a fix of this bug ported to the Silva 1.5 branch?

Changed in silvadocument:
assignee: nobody → thisfred
Revision history for this message
Eric Casteleijn (thisfred) wrote :

I'll check this in to all branches and ask someone to do some testing.

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Wim could you test this in 1.6 and 1.5 after the sprint?

Changed in silvadocument:
assignee: thisfred → wim-boucquaert
Revision history for this message
Wim Boucquaert (wim-boucquaert) wrote : Re: [Bug 132492] Re: Bug in table edit of forms editor

thisfred wrote:
> Wim could you test this in 1.6 and 1.5 after the sprint?
>
> ** Changed in: silvadocument (upstream)
> Assignee: thisfred => Wim Boucquaert
>
>
Ok thisfred tagged and put on my todo list

Revision history for this message
Eric Casteleijn (thisfred) wrote :

I unfortunately checked in a stupid typo with this fix (aq_explixit instead of aq_explicit) and apparently testing didn't catch it. It's fixed on all branches and trunk now, and is in SilvaDocument-2.0.2

Revision history for this message
Kit Blake (kitblake) wrote :

Explicit is better than explixit, hyuk, hyuk, hyuk

Changed in silvadocument:
status: New → Fix Committed
Changed in silva:
importance: Undecided → Medium
status: New → Fix Committed
Changed in silvadocument:
importance: Undecided → Medium
Changed in silvadocument:
status: Fix Committed → Fix Released
Changed in silva:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.