what is your model ?
Em sex, 2 de ago de 2019 às 14:50, Константин Комков <[email protected]>
escreveu:
> I do like that:
> row = db().select(db.recipes.IMAGE).first()
> image = '<img src="'+URL('default','download',args=row.file)+'"/>'
> I get error:
> Версия
> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
> Python Python 3.7.3: C:\Python\python.exe (prefix: C:\Python)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
>
> Traceback (most recent call last):
> File
> "C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\packages\dal\pydal\objects.py",
> line 116, in __getattr__
> return self.__getitem__(k)
> File
> "C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\packages\dal\pydal\objects.py",
> line 103, in __getitem__
> raise KeyError(key)
> KeyError: 'file'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\restricted.py", line
> 219, in restricted
> exec(ccode, environment)
> File
> "C:\Users\kkomkov.TIMACAD\Desktop\web2py\applications\Recipes\controllers/default.py",
> line 176, in <module>
> File "C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\globals.py", line 421,
> in <lambda>
> self._caller = lambda f: f()
> File
> "C:\Users\kkomkov.TIMACAD\Desktop\web2py\applications\Recipes\controllers/default.py",
> line 12, in index
> recipes = selectRecipes()
> File
> "C:\Users\kkomkov.TIMACAD\Desktop\web2py\applications\Recipes\controllers/default.py",
> line 111, in selectRecipes
> image = '<img src="'+URL('default','download',args=row.file)+'"/>'
> File
> "C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\packages\dal\pydal\objects.py",
> line 118, in __getattr__
> raise AttributeError
> AttributeError
>
> Error snapshot [image: help]
> <http://127.0.0.1:8000/admin/default/ticket/Recipes/127.0.0.1.2019-08-02.16-34-49.640a0e3a-be79-4185-9717-198d5a82136e#>
>
> AttributeError()
>
> inspect attributes
> Frames
>
> -
>
> *File C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\restricted.py in
> restricted at line 219* код аргументы переменные
> -
>
> *File
>
> C:\Users\kkomkov.TIMACAD\Desktop\web2py\applications\Recipes\controllers\default.py
> in <module> at line 176* код аргументы переменные
> -
>
> *File C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\globals.py in
> <lambda> at line 421* код аргументы переменные
> -
>
> *File
>
> C:\Users\kkomkov.TIMACAD\Desktop\web2py\applications\Recipes\controllers\default.py
> in index at line 12* код аргументы переменные
> -
>
> *File
>
> C:\Users\kkomkov.TIMACAD\Desktop\web2py\applications\Recipes\controllers\default.py
> in selectRecipes at line 111* код аргументы переменные
>
> *File
> C:\Users\kkomkov.TIMACAD\Desktop\web2py\gluon\packages\dal\pydal\objects.py
> in __getattr__ at line 118* код аргументы переменные
> Function argument list
>
> (self=<Row {}>, k='file')
> Code listing
>
> 113.
> 114.
> 115.
> 116.
> 117.
> 118.
> 119.
> 120.
> 121.
> 122.
>
>
> def __getattr__(self, k):
> try:
> return self.__getitem__(k)
> except KeyError:
> raise AttributeError
>
> def __copy__(self):
> return Row(self)
>
> Variables
>
> - builtinAttributeError <class 'AttributeError'>
> - If I do like that:
> rows = db().select(db.recipes.ALL)
> for row in rows:
> if row.recipes.IMAGE is None:
> image = ''
> else:
> image = '<img src="'+URL('default','download',args=row.recipes.
> IMAGE)+'"/>'
> - I get HTML without image:
> - <img src=
>
> "/Recipes/default/download/%3Cfdb.fbcore.BlobReader%20object%20at%200x04E09C50%3E"
> />
> -
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/a782e7f9-ff3d-4d0c-affb-5f80bd94f480%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/a782e7f9-ff3d-4d0c-affb-5f80bd94f480%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/CAEM0BxNbjy4K6TetnGxjJmdSWP1fJJL-hv%3Dd3zBXeT0Zpm%2BrLw%40mail.gmail.com.