>
> When the user inserts a subgroup this works, however, when the user 
> updates the name and description and does not
>
re-upload an image I get the following error:
>
> Is there a way to prevent this from happening?
>
> Traceback (most recent call last):
>   File "/Users/iannet/web2py-deutschland/gluon/restricted.py", line 220, in 
> restricted
>     exec ccode in environment
>   File 
> "/Users/iannet/web2py-deutschland/applications/myleonexus/controllers/group.py"
>  <http://127.0.0.1:8000/admin/default/edit/myleonexus/controllers/image.py>, 
> line 190, in <module>
>   File "/Users/iannet/web2py-deutschland/gluon/globals.py", line 385, in 
> <lambda>
>     self._caller = lambda f: f()
>   File "/Users/iannet/web2py-deutschland/gluon/tools.py", line 3287, in f
>     return action(*a, **b)
>   File 
> "/Users/iannet/web2py-deutschland/applications/myleonexus/controllers/group.py"
>  <http://127.0.0.1:8000/admin/default/edit/myleonexus/controllers/image.py>, 
> line 63, in grp_subgroup
>     form.vars.imageFilename = request.vars.image.filename
> AttributeError: 'str' object has no attribute 'filename'
>
>
> Is there a way to prevent this from happening?
>

if hasattr(request.vars.image, 'filename'):


Furthermore, in case of an update form the form does not indicate that an 
> image file has already been uploaded, the image
> field is a browse button and the message 'no file selected'.
>
> I read the book's part on an image blog and SQLFORM and uploads, in the 
> examples the image field shows a file link and an
> option to delete just the image not the record. I did not get this to work 
> for I wasn't able to figure out how upload=URL('download')
> works. In case of the img_logo table it has the following scr selector: 
> scr=“/myleonexus/image/download/img_logo.image.beca…67.png”
> where myleonexus is the application, image is the controller, but download 
> is not a function in the image controller.
>

Not sure this is the problem, but when you pass only a single argument to 
URL(), it assumes that is the function name and fills in the rest of the 
URL with the current app and controller. If your download function is 
elsewhere, you need to specify that in the URL() function.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to