durusmail: quixote-users: Some proposed changes to Quixote
Some proposed changes to Quixote
Some proposed changes to Quixote
Greg Ward
On 04 December 2000, Neil Schemenauer said:
> >    We might also want to put the guts of publish.py into
> >    a Publisher class, to avoid reliance on keeping state in module-
> >    level globals.
> Maybe but why does it matter?  Isn't there going to be one
> Quixote process per namespace?  The only global state I see is
> exit_now which really applies to the Quixote process anyhow.

Oops, you're right: I was confusing the config module on disk (which is
one lump of state shared by *all* Quixote processes) with the publish
module in memory (which is per-process).

OK, no need for a Publisher class so far.  Everything else stand.

> One solution would be to have the configuration in the cgi script
> itself.  Something like:
>     from quixote.config import Config
>     import mems.ui
>     config = Config(root_namespace=mems.ui,
>                     url_prefix="/q",
>                     ...)
>     ...
>     publish.call_fcgi(config)

It seems to me like every Quixote application pretty much has to write
its own CGI script.  This doesn't bother me too much, but Quixote should
provide all the facilities needed to initialize through its 'init'
module.  That is, I would change the above to

    from quixote import init
    config = init.read_config(filename)

Where 'filename' points to something that looks much like the current
config.py, but isn't installed with Quixote.

  * probably want a way to "cascade" config files, ie. read most
    information from the quixote.config module, then override
    a few things with an application-specific file (that way,
    things like SECURE_ERRORS and ERROR_EMAIL only have
    to be set once)

  * setting the root namespace might have to be done outside of
    the config file, since it's not necessarily a string (I don't
    think we should encourage important modules and instantiating
    classes in a config file!).  Eg.:

      config = init.read_config(filename)
      config.root_namespace = MyApplication()