[Twisted-Python] Passing extra arguments to twistd?

Terry Jones terry at jon.es
Fri Jun 9 18:50:25 EDT 2006


Hi Jean-Paul

OK, I take your point. Below are a couple more reasons why I still think it
would be useful.

>>>>> "JPC" == Jean-Paul Calderone <exarkun at divmod.com> writes:
JPC> .tac files _are_ configuration, so they don't _take_ configuration.
JPC> You should have so little code in your .tac file that it is neither
JPC> burdensome nor distasteful to make a copy and change bits of it to
JPC> meet particular configuration requirements.

.tac files don't always seem to be that small:

~/Nevow-0.8.0/examples $ find . -name '*.tac' -print0 | xargs -0 wc -l
     12 ./blogengine/blogengine.tac
      7 ./chatola/chatola.tac
    189 ./examples.tac
      9 ./image_uploader/imagination.tac
     13 ./liveanimal/liveanimal.tac
     25 ./pastebin/pastebin.tac
      9 ./postit/postit.tac
     18 ./todo/todo.tac
    483 ./userdb/userdb.tac
     40 ./with_axiom/main.tac
    805 total

I'd like to avoid making people edit python files in what I distribute. I
know it seems easy, that it is easy, but it's also easy to provide a
familiar .ini style config file and let them edit that. Then the .ini file
could be passed to twistd and on to my app. This minimizes duplicated code
in the case that the .tac file is non trivial and is more idiot proof
(especially given python's indentation sensitivity).

Anyway, for now I'm taking your advice and simply embedding a config file
name in my .tac file. It's not a big deal - I was just wondering.

Thanks again,
Terry




More information about the Twisted-Python mailing list