Re: Separation of Code in CGI App

2005-07-23 Thread Bruno Desthuilliers
Rob Cowie a écrit : > Hi, > > I need to create a planner/calendar system using python cgi scripts. It > is my first CGI app (beyond a few tutorial examples). > (snip) You may want to have a look at the cgi_app mini-framework: -> http://thraxil.org/code/cgi_app/ It's a port of a Perl framework,

Re: Separation of Code in CGI App

2005-07-22 Thread Paul McNett
Rob Cowie wrote: > So to be clear, if a .py module is in the same directory as my python > cgi script, I can import it thus 'import XXX.py'? Not quite. If you had a XXX.py, XXX.pyc, and/or XXX.pyo in the same directory as your Python cgi script, you'd import it by issuing: import XXX -- Paul

Re: Separation of Code in CGI App

2005-07-22 Thread Rob Cowie
Thanks, I have run through the tutorial - very good. One day, I'd like to try and organise a similar tutorial involving CGI programming. There are several very basic examples, but they leave plenty of unanswered questions such as how to best structure a cgi app, apache permissions, etc So to be c

Re: Separation of Code in CGI App

2005-07-22 Thread Paul McNett
Rob Cowie wrote: > So, do I separate out whatever code I want to into .py modules, then > have the cgi script import them, and utilise them as required? Bingo! > If so, do I need to put these modules somewhere described in the System > Path? Put them in the same directory, and you don't have t

Re: Separation of Code in CGI App

2005-07-22 Thread Rob Cowie
So, do I separate out whatever code I want to into .py modules, then have the cgi script import them, and utilise them as required? If so, do I need to put these modules somewhere described in the System Path? Can I modify the PATH at runtime to point to my modules? How? Cheers for being patient!

Re: Separation of Code in CGI App

2005-07-22 Thread Sybren Stuvel
Rob Cowie enlightened us with: > I need to create a planner/calendar system using python cgi scripts. > It is my first CGI app (beyond a few tutorial examples). Are you sure you want to use CGI? I'd go for mod_python instead if at all possible, since that'll give you a much better performance. >

Separation of Code in CGI App

2005-07-22 Thread Rob Cowie
Hi, I need to create a planner/calendar system using python cgi scripts. It is my first CGI app (beyond a few tutorial examples). I wish to separate the code according to function. For instance, the code to handle the DB connection, SQL querying, HTML form variable retrieval, rendering of HTML vi