On Apr 19, 2004, at 9:54 PM, Graham Fawcett wrote: > I'm pretty sure that in the demo, "ui" and its contents represent the > user interface. The main "qxdemo" directory contains "qxdemo/ui" but > it also contains the other stuff, such as the CGI script, etc. What > I'm saying is, I wouldn't advise trying to publish "qxdemo" but rather > "qxdemo.ui". Keep all of your PTL modules in the qxdemo/ui tree, and > publish that; use the root directory only for configuration files, CGI > scripts, etc. That way, you'll have a nicely organized codebase. Thanks. This is the kind of guidance I need to keep my development efforts aligned with quixote best practices (to the extent that they exist...) > So, I'd use > > Publisher('qxdemo.ui') > > in your CGI script, Yes. Now it makes sense why. > and in qxdemo/ui/__init__.py, I'd include > > import books, keywords > _q_exports = ['links', 'books', 'keywords'] Actually, I have: ''' _q_exports = ['links', 'book', 'keywords'] from qxdemo.ui import links from qxdemo.ui.links import book, keywords ''' because 'book' and 'keywords' are inside the links.ptl file. I also have a _q_index method in here as a springboard for the various demo features. One issue I had was the trailing slash in the URLs: href="links/" *required* the trailing slash to work (until I set FIX_TRAILING_SLASH = 1 in the .conf file). The other two URLs, href="book" and href="keywords" would *only* work *without* the trailing slash. Anyway, I prefer no trailing slash, so setting FIX_TRAILING_SLASH = 1 makes all the URLs consistent. > So: all of the UI stuff (PTL files and so on) go in the "ui" tree. In > the root folder, you have CGI scripts, configuration files, and what > have you. Your application might also grow a "qxdemo/app" tree where > you could have modules that pertain to your application, but are > related to logic and not to presentation (e.g., database connection > stuff, class definitions for "back-end" objects, utility functions, > etc.). It's not strictly necessary; but for maintainability, testing > and readability, it's nice to keep as much of your logic out of the > PTL modules as possible. Thanks to Graham's patience, I now have a working version of the links demo using a .cgi driver and can proceed to experiment/tinker to begin climbing the quixote slope. However, I'm still baffled by the mechanics of importing and exporting files and methods *across directories*. Say, for example, I had a subdirectory inside the /qxdemo/ui directory - let's call it 'foo' and it has a 'bar.ptl' page with a method called 'run()'. How and where do I expose the 'run()' method? From /qxdemo/ui/__init__.py? From /qxdemo/ui/foo/__init__.py? From both? All the failed experiments I tried with qxdemo have left me wondering how to think 'quixotically' with respect to exposing methods and pages to the web across directories. >> (Also, I was wondering if it might be possible to use __init__.ptl >> files instead of __init__.py ones?) > > Not out of the box. But there's a patch for Quixote 0.6 that might > still work: > > http://mail.mems-exchange.org/pipermail/quixote-users/2003-May/ > 001519.html Thanks; I'll look into it later. John Miller