Ticket #1719 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

tg.defaultview = "genshi" and tg.mochikit_suppress = True raises Exception Attribute Error

Reported by: dazzaredgrave Assigned to: faide
Priority: normal Milestone: 1.1
Component: TurboGears Version: 1.0.4.3
Severity: normal Keywords:
Cc:

Description

if you set these options in your app.cfg an AttributeError? is raised:

  • tg.defaultview = "genshi"
  • tg.mochikit_suppress = True

trace can be found here. tg-admin info can be found here

It's raised because the display of the turbogears.base.Widget.display returns an empty list when turbogears.base.MochiKitLink?.template is rendered AND suppress is True. I have 'fixed' it locally by changing turbogears.base.MochiKitLink?.template to:

    <span xmlns:py="http://purl.org/kid/ns#" py:strip="True">
        <script py:if="not suppress" type="text/javascript" src="$link"/>
        <script py:if="suppress" type="text/javascript"></script>
    </span>

The trade off here is that when mochikit is supressed you get an empty script tag appear in the head of the rendered page. The alternative is to check turbogears.base:280 transforms return value and make an ElementTree? from the empty list returned. A data change seemed safer to me.

Change History

02/13/08 09:58:39 changed by droggisch

  • owner changed from anonymous to droggisch.

05/23/08 08:33:15 changed by droggisch

  • owner changed from droggisch to faide.

Fixed as suggested - I don't think that anything more fancy as fix is needed & that an empty <script>-tag doesn't cause any problems.

05/23/08 08:33:33 changed by droggisch

Revision is r4601

08/24/08 10:27:00 changed by faide

  • milestone changed from 1.5 to 1.1.

08/27/08 12:39:05 changed by Chris Arndt

Can this ticket be closed or do you still plan to implement the alternative solution?

08/28/08 02:04:40 changed by faide

  • status changed from new to closed.
  • resolution set to fixed.

Seems fine to me... Let's close this one.