I have One form for multiple tables working very well locally, I can
include data and upload images normally on rocket server and sqlite.

my model

*                      Field("author", "reference auth_user"),
> **                      Field("author_nickname", "string"),
> **                      Field("title", "string"),
> **                      Field("description", "text"),
> **                      Field("picture", "upload"),
> **                      Field("thumbnail", "upload"),
> **                      Field("draft", "boolean"),
> **                      Field("tags", "list:string"),
> **                      Field("keywords", "string"),*


My form (form.factory for multiple tables, no fields repeated, works ok on
nginx and sqlite):


*        import os
>         path = os.path.join(request.folder, 'uploads')
>         if request.env.web2py_runtime_gae:
>             db.article.picture.uploadfolder = path
>             db.article.thumbnail.uploadfolder = path
>         else:
>             db.article.picture.uploadfield = "picture_blob"
>             db.article.thumbnail.uploadfield = "thumbnail_blob"
>         form = SQLFORM.factory(db.article, db.article_content,
> table_name="article")
>         if form.process().accepted:
>             try:
>                 id =
> db.article.insert(**db.article._filter_fields(form.vars))
>                 form.vars.article_id = id
>                 id
> = db.article_content.insert(**db.article_content._filter_fields(form.vars))
>             except Exception:
>                 db.rollback()
>                 response.flash = T("error including")
>             else:
>                 db.commit()
>                 response.flash = self.T("Included.")*



But, in GAE data are inserted, but no the images are not inserted in to
blob field, in GAE web2py created "picture_blob" and "thumbnail_blob"
automatically, it works ok with SQLFORM and CRUD, but does not works with
SQLFORM.factory. I get the *_blob fields <none>

Someone knows about it?

Thanks

-- 

Bruno Rocha
[http://rochacbruno.com.br]

Reply via email to