Google Groups Home
Help | Sign in
aspen handling of form post
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
infotek  
View profile
 More options Mar 15, 12:55 pm
From: infotek <info...@gmail.com>
Date: Sat, 15 Mar 2008 09:55:43 -0700 (PDT)
Local: Sat, Mar 15 2008 12:55 pm
Subject: aspen handling of form post
Hi,

  I'm interested in using aspen as a configuration interface... where
aspen serves an HTML form, pre-populated  based on the contents of a
configuration file.  I would like the values to be adjustable by the
users who could then post the page back to aspen.  Finally i would
like aspen to do some sanity checks on the data that was submitted and
write the data back to the config file.

  Basically, I want to allow a user to modify the configuration file
of an application I'm working on using a web browser.

  At first look, I think aspen can do it via its handlers.  I wanted
to ask before I begin to invest significant amount of time
understanding python and aspen more as I'm not that good of a
programmer.

-Jason Ellison

PS:  this is related to a project for turning old laptops into picture
frames named "flickr-pitchr".  The program is wrtten in python and
downloads images from flickr.com for display via SDL on a framebuffer
device.

http://code.google.com/p/flickr-pitchr/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chad Whitacre  
View profile
 More options Mar 17, 10:18 am
From: Chad Whitacre <c...@zetaweb.com>
Date: Mon, 17 Mar 2008 10:18:31 -0400
Local: Mon, Mar 17 2008 10:18 am
Subject: Re: aspen handling of form post
Jason,

Yeah, should work. Do you have aspen installed? Try getting a
stdlib simplate running:

http://www.zetadev.com/software/aspen/0.8/doc/html/api-handlers-simpl...

Simplates wiring example here:

http://www.zetadev.com/software/aspen/0.8/doc/html/handlers-conf.html

Then write your simplate like this:

"""
import os

CONF = os.path.join('path', 'to', 'file.conf')

^L

if environ['REQUEST_METHOD'] == 'POST': # <could be wrong API!>
     blah = parse_form(environ)
     fp = open(CONF)
     fp.write(blah)

^L
<html>
<form action="<self>" method="POST">
...
</form>
</html>
"""

Check WebOb for environ wrapper:

   http://pythonpaste.org/webob/

hth,
chad


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google