durusmail: quixote-users: Quixote 2.0 quixote.server.util.main()
Quixote 2.0 quixote.server.util.main()
2004-12-10
Quixote 2.0 quixote.server.util.main()
Paul Moore
2004-12-10
I like the new server infrastructure - in particular
quixote.server.util.main. But there's one area where it is not very
reusable - the default values. The defaults are hard coded into the
main() function, and whereas most of them are not unreasonable, the
factory seems unlikely to be a good default for anything other than
the demo.

It would seem better to have a Main class, with the defaults set as
class variables, and a main() method which gets the defaults from the
instance. Something like:

    Main:
        default_host = 'localhost'
        default_port = 8080
        default_factory = 'quixote.demo.create_publisher'

        def main(self, run):
            # as before, but use self.default_XXX

Usage is then:

    main = Main()
    main.default_factory = 'my_factory'
    main.main(run)

Hmm, that's not perfect. But I can't see any obvious way of doing
something similar with the current code (short of gross hacking :-))

Any comments?
Paul.

reply