Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #969 (closed defect: fixed)

Opened 11 years ago

Last modified 10 years ago

[changed]: Templates not extending master generate very unhelpfull error messages

Reported by: trlandet Owned by: anonymous
Priority: normal Milestone: 1.0b2
Component: Kid Version: 0.9a6
Severity: normal Keywords:
Cc:

Description

There is an error in kid when using py:defs with multiple code paths. What happens is that when one code path is triggered TurboGears+Kid will sometimes choose to 'optimize away' other code paths (I think that may be the case, anyway). When an other page is requested that triggers one of the other code paths I get "TypeError?: 'NoneType?' object is not callable". To me it seems like the elements that were not needed on the previous run are not there, but Kid thinks they should have been.

Example:

someBasePage.kid

<div py:def="hello(sayWhat, disable=False)">
    <div py:if="not disable" py:content="sayWhat"/>
    <div py:if="disable">no message</div>
</div

childPageOne.kid

<div py:replace="hello('Hello world!')"/>

childPageTwo.kid

<div py:replace="hello('Hello world!', disable=True)"/>

I can't reproduce this using only Kid. It won't triger (in pure Kid) if my master template does not extend sitetemplate or if my master template has no py:defs on it's own (in TurboGears). I think there must be a problem with Kid+TurboGears. I get the same problem by using py:strip instead of py:if.

I'm using TurboGears 0.9a6 on Python 2.4 on Windows XP

Attachments

master.kid Download (735 bytes) - added by trlandet 11 years ago.
Mater template with py:def and extends sitetemplate
someBasePage.kid Download (261 bytes) - added by trlandet 11 years ago.
base page with py:def
childPageOne.kid Download (531 bytes) - added by trlandet 11 years ago.
childPageTwo.kid Download (545 bytes) - added by trlandet 11 years ago.

Change History

Changed 11 years ago by trlandet

Mater template with py:def and extends sitetemplate

Changed 11 years ago by trlandet

base page with py:def

Changed 11 years ago by trlandet

Changed 11 years ago by trlandet

comment:1 Changed 11 years ago by trlandet

My controller looks like:

    @expose(template="test.templates.childPageOne")
    def childOne(self):
        return dict()
    
    @expose(template="test.templates.childPageTwo")
    def childTwo(self):
        return dict()

comment:2 Changed 11 years ago by trlandet

  • Summary changed from Node creation error in Kid ('NoneType' not callable) to [changed]: Templates not extending master generate very unhelpfull error messages

It seems this is related to someBasePackage not extending the master template.

The server must be restarted every time someBasePage is edited, which is a big annoyance

I'm leaving this open because the 'NoneType?' not callable error is just too obscure. There should be a more helpfull error message telling you to restart the server

comment:3 Changed 11 years ago by jorge.vargas

  • Milestone set to 1.0b2

please verify this was fix with the "NoneType?" not callable fix

comment:4 Changed 11 years ago by trlandet

  • Status changed from new to closed
  • Resolution set to fixed

I have changed too much to reproduce this just now, so I am closing this bug. I will reopen if I get get the same error again

Note: See TracTickets for help on using tickets.