durusmail: quixote-users: Re: import and export - help!
import and export - help!
2004-04-18
Re: import and export - help!
2004-04-19
2004-04-20
2004-04-20
2004-04-20
2004-04-20
2004-04-21
2004-04-21
Jason E. Sibre (2 parts)
2004-04-21
Re: import and export - help! (resolved)
2004-04-21
2004-04-20
2004-04-20
Re: import and export - help!
Graham Fawcett
2004-04-19
John Miller wrote:

> So I think the problem is the arrangement of _q_exports and import
> statments in the __init__.py files. Here's my naive guess at what it
> should be:
>
> qxdemo/__init__.py --->  '''_q_exports = ['links'] from qxdemo import
>  links''' # entire file
>
> qxdemo/links.py --->  class definitions file (no quixote exports)
>
> qxdemo/ui/__init__.py ---> '''_q_export = ['links'] from qxdemo.ui
> import links''' # entire file

You nailed it, John: it looks like there's a bug in qxdemo. That line
ought to read

     _q_exports = ['links']

Note the pluralization.

> This arrangement, however, doesn't work. Can someone suggest what the
>  proper arrangement of imports and exports is (and the Publisher
> instance: 'qxdemo' or 'qxdemo/ui'?) so that the initial _q_index
> method can be found?

I've never run the demo app, but the cgi script looks like it wants to
publish 'qxdemo.ui.links' as the root user interface.

If you fix the "_q_export" bug above, then there's no reason you
couldn't use 'qxdemo.ui' instead of "qxdemo.ui.links". But since
'qxdemo.ui' only provides a single export ('links') and provides no
functions of its own, then you wouldn't get any functionality without
adding 'links/' to the end of your URL (as in
http://hostname/scriptpath/links/ ). So it's probably better to use the
'qxdemo.ui.links' export as the root UI, unless you're planning to add
some non-'links' related functions at the root level.

Mind you, that's not a bad idea; it's sometimes nice to have a
mostly-empty root namespace, so that you can add in things later that
you didn't realize you'd need: for example, maybe a StaticDirectory,
'resources/', where you could put style sheets or graphics, a 'doc/' URL
that could publish help files, etc. Having a "clean root" means you
could add this stuff without having to clutter up the original 'links' code.

Many thanks for any assistance anyone may offer.
> I'm keen to get this demo running so that I can start learning
> quixote  publishing.

Best of luck!

-- Graham



reply