Can you send a copy of your master.kid? Since you say that this error
keeps coming up, I'm beginning to think that something is amiss in the template.
One would think, wouldn't one? :-)
I'm going to try out the various suggestions I've gotten today, see if I can get it back to an even keel, then break it again so I can give you a more detailed breakdown of events.
> My expectation here would be that excess values would be ignored. Is this a
> Kid thing? Here's the basis of my expectation:
>
> >>> d = {'test1':'test1', 'test2':'test3'}
> >>> d
> {'test1': 'test1', 'test2': 'test3'}
> >>> s = "%(test1)s %(test2)s"
> >>> s%d
> 'test1 test3'
> >>> s2 = "%(test1)s"
> >>> s2%d
> 'test1'
>
> As can be seen in the example, s2 only 'knows' to 'render' the 'test1'
> member, and even though it is passed a dict with both 'test1' and 'test2',
> Python doesn't complain about the extra data.
Actually, the code above is not equivalent to what you described with the Kid template. This code is equivalent:
>>> d = {'test1':'test1', 'test2':'test3'}
>>> s = "%(test1)s %(test2)s"
>>> s%d
'test1 test3'
>>> del d["test1"]
>>> s%d
Traceback (most recent call last):
File "<stdin>", line 1, in ?
KeyError: 'test1'
Well, what I am saying is that BOTH appear to be happening. That is, if the dict I return has one too many attributes, or one too few, it breaks. I can deal with the latter scenario you just presented - this is perfectly consistent, python-wise. The former that I described is what is troubling me.
${getattr(self, 'now', None)}
if you want to be certain to not blow up on a missing variable.
There's a ticket open to add a trivial function to Kid that does the
same thing in a prettier way.
That would be good - it would be bad for a production server to go down over such a trivial thing. (Of course, it would be bad to post a page without TESTING it first, which is about the only way that could happen :-)
> I don't know if you would classify it as a bug or a design limitation that
> can't be avoided, or something else entirely.
something else entirely :)
That's my luck, all over :-)
The learning curve's not bad, but there is some learning to do and the docs do not touch upon every last possibility... Bit by bit, it gets
better, though. And there are lots of people answering questions here now!
I have to say, it's a lot easier to get started when compared to some other python web framework platform thingy (*cough*) which is why I came back to it after pouting over my shortcomings for a few days :-)
I'll get back to you in a few.
--
"Things fall apart. The Center cannot hold."
- Life as a QA geek, in a nutshell.
Best,
Jeff

