[albatross-users] New tag reference

Dave Cole djc at object-craft.com.au
Sun Jun 29 19:38:46 EST 2003


>      > 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-generic.html
    http://www.object-craft.com.au/projects/albatross/albatross/tag-input-image.html
    http://www.object-craft.com.au/projects/albatross/albatross/tag-input-file.html

- Dave

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




More information about the Albatross-users mailing list