Ticket #1719 (closed defect: fixed)
tg.defaultview = "genshi" and tg.mochikit_suppress = True raises Exception Attribute Error
| Reported by: | dazzaredgrave | Owned by: | 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
comment:2 Changed 4 years ago 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.