[albatross-users] New tag reference

Michael C. Neel neel at mediapulse.com
Mon Jun 30 09:04:24 EST 2003


Dave,

	You're all over the docs this week =)  Yes, this looks really
awesome and helps show the "full circle" of a form.  Since using
albatross I now know the request objects are from the cgi FieldStorage
class, or at least act like they are; but when I started out I'd never
programmed with the cgi module (nor do I intend to, lol) so I was a bit
lost.  Those that have used the cgi module probably don't need this, but
those of us that didn't will find this vey helpful.

	At some point you might consider documenting these objects
completely (read: cut-n-paste from the cgi.Fieldstorage docs) just to
have it all in one place; but this isn't all that important.

Mike

     > -----Original Message-----
     > From: Dave Cole [mailto:djc at object-craft.com.au] 
     > Sent: Sunday, June 29, 2003 5:39 AM
     > To: Michael C. Neel
     > Cc: albatross-users at object-craft.com.au
     > Subject: Re: [albatross-users] New tag reference
     > 
     > 
     > 
     > >      > Looks like I missed this post too, but this looks really
     > >      > great.  The one part I would add is an example 
     > of each tag on
     > >      > the form side being parsed on submission, i.e.  
     > showing how
     > >      > to get at the data from a <al-input type=file> etc.
     > >  
     > > What you have is:
     > > 
     > > >>> import albatross
     > > >>> class Ctx(albatross.SimpleContext):
     > > ...     def input_add(self, *args):
     > > ...         print args
     > > ... 
     > > >>> ctx = Ctx('.')
     > > >>> albatross.Template(ctx, '<magic>', '''
     > > ... <al-input type="file" name="resume" whitespace>
     > > ... ''').to_html(ctx)
     > > ('file', 'resume', None, 0)
     > > >>> ctx.flush_content()
     > > <input type="file" name="resume">
     > > 
     > > What I'd like to see added after that is:
     > > 
     > > # page module code, inside page_process(), saves the 
     > uploaded file
     > > if ctx.req_equals("resume") and len(ctx.locals.resume.value):
     > >     filename = "/home/uploads/resumes/new_file.txt"
     > >     file = open(filename, 'wb')
     > >     file.writelines(ctx.locals.image.value)
     > >     file.close()
     > > 
     > > Actually, it should be alittle more than that, showing 
     > getting the
     > > filename as it was on the client's system - but this 
     > is off the top of
     > > my head and I don't remember where that's stored atm 
     > (hence the need for
     > > the reference =)
     > 
     > Can you please check the following and tell me if it 
     > addresses the
     > problem you raised?
     > 
 
http://www.object-craft.com.au/projects/albatross/albatross/tag-input-ge
neric.html
 
http://www.object-craft.com.au/projects/albatross/albatross/tag-input-im
age.html
 
http://www.object-craft.com.au/projects/albatross/albatross/tag-input-fi
le.html

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list