CGI FieldStorage instances?

G

Gnarlodious

I'm having a hard time understanding this, can someone explain?

Running a CGI with query string:

?action=Find&page=Data

Script includes these lines:

form=cgi.FieldStorage(keep_blank_values=1)
print("Content-type:text/html\n\n")
print(cgi.print_form(form))

Output:

Form Contents:

action: <class 'cgi.MiniFieldStorage'>
MiniFieldStorage('action', 'Find')
page: <class 'cgi.MiniFieldStorage'>
MiniFieldStorage('page', 'Data')


It looks like every variable in the query string instantiates a
MiniFieldStorage with that value, is that the case? And if so, what
sort of cool tricks could I do with that feature? Because so far I am
doing CGI and it is a big old mess. Intercepting every variable is
complicated and confusing. Is there an easier way?

-- Gnarlie
 
G

Gnarlodious

Let me rephrase the question. Say I have a query string like this:

?view=Data&item=9875

What I want to do is simply invoke process "view" with variable
"Data". This would replace my existing query string mess which looks
like this:

if 'view' in form and 'item' in form:
HTML=view(Data, item(9875))

so it just seems like it would be easier to encode the process in the
query rather than filtering the query string.

-- Gnarlie
 
D

Dennis Lee Bieber

Let me rephrase the question. Say I have a query string like this:

?view=Data&item=9875

What I want to do is simply invoke process "view" with variable
"Data". This would replace my existing query string mess which looks
like this:
So... Can you make "view" a "page" (CGI program) with one query
item...

.../view/?item=9875

Or upgrade to some modernistic framework wherein the application is
a monolithic program and the "name/" portion maps to methods/functions
within the application...
 
G

Gnarlodious

        Or upgrade to some modernistic framework wherein the application is
a monolithic program and the "name/" portion maps to methods/functions
within the application...

Yes, that describes what I am looking for! Is there such a modernistic
framework? Links?

-- Gnarlie, K5ZN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top