Forgot to mention, I need this on google appengine.

My hack so far:
    - create a new DB table, 'default images' 

     db.define_table('default_images',
           Field('name', requires=IS_NOT_EMPTY()),
           Field('uploaded','upload', requires=IS_NOT_EMPTY()))

    - create a admin-only function which allows upload of default images

    - now when a new user is to be created, I can pre-populate their 
      'person' record with the default image:

        default_headshot = db(db.default_images.name == 
'default_headshot').select().first()

        new_me = db.person.insert(email = session.auth.user.email, 
                         first_name = session.auth.user.first_name,
                         last_name = session.auth.user.last_name,
                         head_shot = default_headshot.uploaded,
                         head_shot_blob = default_headshot.uploaded_blob)
                         # below doesn't work
                         # head_shot = URL(c='static', f='images', 
'default_headshot.jpg'))
        form = SQLFORM(db.person, new_me)

This works, except that the first time the controller runs and creates the 
new record,
the SQLFORM does not display the image.  On subsequent calls, 
(if the person wants to change their profile info), it does show properly.


Is there a smarter/easier way???

thanks,
Luis.

Reply via email to