Basically, after editing templates I sometimes get an error looking
like this:
[...Numerous other lines elided...]
File "f:\code\python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\serialization.py", line 109, in serialize
text = ''.join(tuple(
File "f:\code\python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\serialization.py", line 622, in generate
stream = iter(stream)
File "f:\code\python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\__init__.py", line 309, in __iter__
return iter(self.transform())
File "f:\code\python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\__init__.py", line 364, in transform
stream = self.pull()
File "f:\code\python24\lib\site-packages\kid-0.9.4-py2.4.egg\kid
\__init__.py", line 323, in pull
self.initialize()
File "F:\code\pyprojects\whatever\whatever\templates\users.py", line
23, in initialize
File "F:\code\pyprojects\whatever\whatever\templates\master.py",
line 23, in initialize
TypeError: 'NoneType' object is not callable
Usually restarting the server makes the problem go away, at least
until the next time.
I don't think upgrading is the solution; I have tg 1.0.1, and kid
0.9.4 which is already 1 step newer than the one on the TG site
(though apparently 1 older than the current version).
Is there a fix for this sort of problem? If not, I'm not too averse to
migrating to a different template library, if that is the only way to
prevent this sort of thing.
--
Ben Sizer
Can you check whether this goes away with Kid 0.9.5? A couple of bugs
have been fixed again. If not, can you provide a simplified test case so
that I can reproduce it?
-- Chris
Ok, I installed the new version of Kid (which requires a new version
of Setuptools too, incidentally.) There's a change, but not a fix. The
error now looks like:
File "F:\code\pyprojects\whatever\whatever\templates\login.py", line
25, in initialize
File "F:\code\pyprojects\whatever\whatever\templates\master.py",
line 25, in initialize
TypeError: 'NoneType' object is not callable
Error in code generated from template file 'F:\\code\\pyprojects\
\whatever\\whatever\\templates\\login.kid'
Interestingly, I seem to see a pattern where I change something in
master.kid, the next page I serve up is fine, and then I get the error
on the second page. For example, after the above error, I edited some
whitespace in master.kid to force Kid to regenerate the .pyc file. I
hit refresh, and the login page worked just fine. Then when I hit
submit, it gave the same error on the subsequent page, the one that
login submits to. So perhaps there's some sort of problem with the
master template not being reinitialised properly for the second and
subsequent access.
Not sure I can create a reproducible test case, however. The problem
is intermittent for me, and goes away with a server restart. My
master.kid is quite simple, though it does contain comments, which I
know some people have mentioned problems with in the past.
--
Ben Sizer
You have changed your login template to extend master, right? I was able
to reproduce this and filed it as http://trac.turbogears.org/ticket/1299
already. We'll have to see whether this needs to be fixed in TurboGears,
Kid or both.
-- Chris
Yes, my login page extends master.kid. (Though I think it was auto-
generated that way, by the Identity quickstart script.)
> I was able
> to reproduce this and filed it as http://trac.turbogears.org/ticket/1299
> already.
Thanks for filing the bug. It seems like you managed to find a pretty
good minimal case. Hopefully someone more familiar with the system
will be able to suggest a way to get more information out of that
traceback.
You've posted there that "this cannot bite you in production". Is that
because the templates don't get reloaded in production mode?
--
Ben Sizer
At least in 1.0.1 the login page for an --identity project does not
extend master. That's what irritated me at first.
> You've posted there that "this cannot bite you in production". Is that
> because the templates don't get reloaded in production mode?
Yes, autoreload should be off and you usually don't change layout
templates in a running system. If you deploy a new version, you should
explicitly reload the server.
-- Chris
This needs clarification I think. The problem is not the autoreloader
(which comes from CherryPy and cares only for .py files, not for .kid
files) but an auto recompile feature in TurboKid that corresponds to the
config setting "kid.precompiled" and that is disabled by default. If
kid.precompiled=True, then TurboGears does not (re)compile kid templates
on the fly, and this problem cannot appear.
-- Christoph
Can you check whether this works for you?
I'm developing on Windows so I don't have diff/patch functionality
close at hand. If you want to email me the edited file off-list
however, I'll gladly give it a try.
--
Ben Sizer
> I'm developing on Windows so I don't have diff/patch functionality
> close at hand. If you want to email me the edited file off-list
> however, I'll gladly give it a try.
Ben,
if you can I suggest you install cygwin on your windows machine. I
always use it when I am on Windows to have the patch/diff functions
and also svn diff/svn status (because tortoisesvn does not produce a
diff file from the changes)
Cheers,
Florent.
about the ticket I'll try to take a look at it during the week.
> Cheers,
>
> Florent.
>
> >
>
TortoiseSVN can create diffs with the "Create patch..." menu command.
-- Chris
> bump - is this solved in the meantime? i´m having the same problem
> with TG 1.0.1, TurboKid-0.9.9-py2.4.egg, kid-0.9.5-py2.4.egg
This what? They're talking about Tortoise and cygwin...
> ---------- Forwarded message ----------
> From: Christoph Zwerschke <c...@online.de>
> Date: 12 Feb., 08:37
> Subject: initialize / NoneType not callable bug
> To: TurboGears
>
>
> Florent Aide wrote:
>> if you can I suggest you install cygwin on your windows machine. I
>> always use it when I am on Windows to have the patch/diff functions
>> and also svn diff/svn status (because tortoisesvn does not produce a
>> diff file from the changes)
>
> TortoiseSVN can create diffs with the "Create patch..." menu command.
>
> -- Chris
--
Jorge Godoy <jgo...@gmail.com>
I believe the status from the bug reports cited there are true. Are you
having different results?
--
Jorge Godoy <jgo...@gmail.com>
but i´m really lucky to have found out, that this won´t happen in
production state (as long as i don´t constantly change the templates)
which was what i feared...
That problem is has been solved, but only in the head revision of
TurboKid. The fix is not in the version 0.9.9 used by you and also not
yet in the last released version 1.0.
Somebody needs to create a 1.0.1 release of TurboKid.
-- Chris