JOTWeb Frequently Asked Questions (FAQ)

  1. If I list multiple tal:attributes replacements, only the first one is done.
  2. I'm trying to do <span tal:content="foo/bar" />, but it is not working.
  3. After an upgrade, I'm getting errors from JOTWeb which appear to be valid code/markup.
  4. Why are my XML pages rendered with no tags?
  5. How do I use cookies in JOTWeb?
  6. How do I cache generated pages in JOTWeb?

If I list multiple tal:attributes replacements, only the first one is done.

For example, if you do:

<a href="placeholder" title="placeholder"
      tal:attributes="href foo/href; title foo/title">Link</a>

The results are not as you expect... Instead of both href and title getting replaced, only href is replaced.

The problem, as reported by Colin Stewart, the SimpleTAL author, is that the TAL specification says that there shouldn't be a space after the semi-colon. This occurs in SimpleTAL versions 3.2 and below at least (3.2 is the current version). Simply changing it to remove any whitespace after the semi-colon should resolve the problem.

The unfortunate thing is that the ZPT Advanced document and likely others give examples where there is white-space after the semi-colon. I haven't heard from Colin wether he plans on changing the way SimpleTAL works because of that. I'd like his input on it before I consider changing the way JOTWeb works.

I'm trying to do <span tal:content="foo/bar" />, but it is not working.

You can't do the shortcut syntax with the TAL tags. You will have to specify both a start and end tag: <span tal:content="foo/bar"></span>

After an upgrade, I'm getting errors from JOTWeb which appear to be valid code/markup.

Don't forget to re-start Apache after upgrading JOTWeb, if you are using mod_python.

Why are my XML pages rendered with no tags?

icepick reports that PyXML causes problems with SimpleTAL (the template attribute system used by JOTWeb). Try removing PyXML and using xmlcore instead.

How do I use cookies in JOTWeb?

There is a standard Python module for cookies called "Cookie". See the code in _getSessionId in the file SimpleSession.py for an example of getting a cookie, and the section under the comment "update cookie" for setting it. This is something that could probably be made easier with a "SimpleCookie" interface.

How do I cache generated pages in JOTWeb?

JOTWeb does not include caching of generated pages internally. For cached results of pages which take a long time to render, I recommend setting a reasonable Expires header and set up a Squid reverse cache. To set up Squid as a reverse cache:

This sets up a test cache on port 81, which you should be able to test with your normal URL but adjusted to add a ":81" at the end of the host name in the URL. Once you've tested it and it looks ok, you will need to flop these around so that Squid is running on port 80 and Apache is serving them on port 81. You can specify the Squid IP address by setting the http_port option to "<IP address>:80". If your Apache still needs to listen on some IP addresses for port 80, you will need to set up "Listen" lines for each of the IP addresses and ports you need it to listen to.

Index