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 #1299 (closed defect: duplicate)

Opened 12 years ago

Last modified 12 years ago

Initialize / NoneType not callable bug

Reported by: chrisz Owned by: anonymous
Priority: normal Milestone: 1.0.2
Component: Kid Version: 1.0.1
Severity: major Keywords:


The following problem was reported by Ben Sizer on the mailing list ( here). I can confirm and reproduce this with the following steps:

  • Create a default quickstart project.
  • Create a duplicate of the welcome.kid template as welcome2.kid
  • Create a duplicate of the index method as index2 in the RootController, using welcome2 as its template
  • Start the TurboGears project
  • Open localhost:8080/index and localhost:8080/index2 in two different browser windows.
  • Change something in the footer text of master.kid
  • Reload both browser windows. When you reload the second window, you get the following error message:
500 Internal error
  File ".../templates/master.py", line 25, in initialize
TypeError: 'NoneType' object is not callable
Error in code generated from template file '...templates/welcome2.kid'

It seems the error is caused by the master template being automatically reloaded when you load the first page, and then when you reload the second page it is not reloaded and still has a reference to the old template which has become invalid. Something like that.

Luckily, this cannot bite you in production, but it surely is very annoying in development. Strange that nobody has complained so far, though tickets #884 and #969 seem to be related.

Change History

comment:1 Changed 12 years ago by chrisz

Just for the record, this error happens with Kid 0.9.3, 0.9.4 and 0.9.5.

comment:2 Changed 12 years ago by chrisz

  • Version changed from 1.0 to 1.0.1

This error has nothing to do with the (CherryPy?) autoreloader, but with a feature in TurboKid? that auto recompiles templates. If you set kid.precompiled=True and compile the templates manually with kidc -s welcome.kid, then everything works (compilation to source is necessary since unidentified .pyc files are deleted on startup).

comment:3 Changed 12 years ago by chrisz

It's still not clear to me whether this needs to be fixed in Kid ( ticket has been created already) or TurboKid?.

comment:4 Changed 12 years ago by chrisz

After some more meditation on this issue, it seems that it cannot be solved in Kid, but only using an improved reload logic in TurboKid? as suggested in patch #1301.

comment:5 Changed 12 years ago by jorge.vargas

  • Component changed from TurboGears to Kid

comment:6 Changed 12 years ago by Kylotan

I can confirm that patch #1301 fixes this for me, using TG 1.0.1 with Kid 0.9.9 on Windows XP.

comment:7 Changed 12 years ago by alberto

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

#1301 was applied in [2810] so this should be fixed.


Note: See TracTickets for help on using tickets.