Re: [web2py] Re: How can I insert image in HTML from database?

2019-08-09 Thread Константин Комков
Ok, I will register issue on github.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAM7z-V%3D7AViw5bc-UEheY6Dg%3DVmGFTUN5SAR9nqtU2hYszo3Mw%40mail.gmail.com.


[web2py] Re: How can I insert image in HTML from database?

2019-08-09 Thread Dave S


On Friday, August 9, 2019 at 1:47:52 PM UTC-7, Константин Комков wrote:
>
> *Val K*, yes, I have database which contain images. I tried use blob ↓.
> I don't know why but if I do like that I have error:
> table.py
> db.define_table(
> 'recipes',
> Field('NAME',length=512),
> Field('IMAGE','*blob*'),
> migrate=False
> )
> and query in controller:
> db().select(db.recipes.IMAGE).first()
> Версия
> web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
> Python Python 3.7.3: C:\Program Files (x86)\Python37-32\python.exe 
> (prefix: C:\Program Files (x86)\Python37-32)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
> 29.
> 30.
> 31.
> 32.
> 33.
> 34.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\restricted.py", line 219, in restricted
> exec(ccode, environment)
>   File "C:\web2py\applications\test\controllers/default.py", line 61, in 
> 
>   File "C:\web2py\gluon\globals.py", line 421, in 
> self._caller = lambda f: f()
>   File "C:\web2py\applications\test\controllers/default.py", line 9, in index
> db().select(db.recipes.IMAGE).first()
>   File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 2395, in select
> return adapter.select(self.query, fields, attributes)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 763, in 
> select
> return self._select_aux(sql, fields, attributes, colnames)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 742, in 
> _select_aux
> return processor(rows, fields, colnames, cacheable=cacheable)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 306, in 
> parse
> for row in rows
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 303, in 
> 
> self._parse(
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 232, in 
> _parse
> value = self.parse_value(value, fit, ft, blob_decode)
>   File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 199, in 
> parse_value
> return self.parser.parse(value, field_itype, field_type)
>   File "C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 100, in 
> parse
> return self.registered[field_itype](value, field_type)
>   File "C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 75, in 
> __call__
> return self.call(value, field_type)
>   File "C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 72, in 
> _call
> return self.f(self.parser, value)
>   File "C:\web2py\gluon\packages\dal\pydal\parsers\base.py", line 37, in _blob
> decoded = b64decode(to_bytes(value))
>   File "C:\web2py\gluon\packages\dal\pydal\_compat.py", line 131, in to_bytes
> raise TypeError('Expected bytes')
> TypeError: Expected bytes
>
> Error snapshot [image: help] 
> 
>
> TypeError(Expected bytes)
>
> inspect attributes
> Frames
>
>- 
>
>*File C:\web2py\gluon\restricted.py in restricted at line 219* код 
>аргументы переменные
>- 
>
>*File C:\web2py\applications\test\controllers\default.py in  
>at line 61* код аргументы переменные
>- 
>
>*File C:\web2py\gluon\globals.py in  at line 421* код аргументы
> переменные
>- 
>
>*File C:\web2py\applications\test\controllers\default.py in index at 
>line 9* код аргументы переменные
>- 
>
>*File C:\web2py\gluon\packages\dal\pydal\objects.py in select at line 
>2395* код аргументы переменные
>Code listing
>
>2390.
>2391.
>2392.
>2393.
>2394.
>2395.
>2396.
>2397.
>2398.
>2399.
>
>attributes.get('join', None),
>attributes.get('left', None),
>attributes.get('orderby', None),
>attributes.get('groupby', None))
>fields = adapter.expand_all(fields, tablenames)
>return adapter.select(self.query, fields, attributes)
>
>def iterselect(self, *fields, **attributes):
>adapter = self.db._adapter
>tablenames = adapter.tables(self.query,
>
>- 
>
>*File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in select at 
>line 763* код аргументы переменные
>- 
>
>*File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in 
>_select_aux at line 742* код аргументы переменные
>- 
>
>*File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in parse at 
>line 306* код аргументы переменные
>- 
>
>*File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in 
> at line 303* код аргументы переменные
>- 
>
>*File C:\web2py\gluon\packages\dal\pydal\adapters\base.py 

[web2py] Re: How can I insert image in HTML from database?

2019-08-09 Thread Константин Комков
I don't know why but if I do like that I have error:
table.py
db.define_table(
'recipes',
Field('NAME',length=512),
Field('IMAGE','*blob*'),
migrate=False
)
and query in controller:
db().select(db.recipes.IMAGE).first()
Версия
web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
Python Python 3.7.3: C:\Program Files (x86)\Python37-32\python.exe (prefix: 
C:\Program Files (x86)\Python37-32)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
  File "C:\web2py\applications\test\controllers/default.py", line 61, in 

  File "C:\web2py\gluon\globals.py", line 421, in 
self._caller = lambda f: f()
  File "C:\web2py\applications\test\controllers/default.py", line 9, in index
db().select(db.recipes.IMAGE).first()
  File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 2395, in select
return adapter.select(self.query, fields, attributes)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 763, in 
select
return self._select_aux(sql, fields, attributes, colnames)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 742, in 
_select_aux
return processor(rows, fields, colnames, cacheable=cacheable)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 306, in parse
for row in rows
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 303, in 

self._parse(
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 232, in 
_parse
value = self.parse_value(value, fit, ft, blob_decode)
  File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 199, in 
parse_value
return self.parser.parse(value, field_itype, field_type)
  File "C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 100, in 
parse
return self.registered[field_itype](value, field_type)
  File "C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 75, in 
__call__
return self.call(value, field_type)
  File "C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py", line 72, in 
_call
return self.f(self.parser, value)
  File "C:\web2py\gluon\packages\dal\pydal\parsers\base.py", line 37, in _blob
decoded = b64decode(to_bytes(value))
  File "C:\web2py\gluon\packages\dal\pydal\_compat.py", line 131, in to_bytes
raise TypeError('Expected bytes')
TypeError: Expected bytes

Error snapshot [image: help] 


TypeError(Expected bytes)

inspect attributes
Frames
   
   - 
   
   *File C:\web2py\gluon\restricted.py in restricted at line 219* код 
   аргументы переменные
   - 
   
   *File C:\web2py\applications\test\controllers\default.py in  at 
   line 61* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\globals.py in  at line 421* код аргументы 
   переменные
   - 
   
   *File C:\web2py\applications\test\controllers\default.py in index at 
   line 9* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\objects.py in select at line 
   2395* код аргументы переменные
   Code listing
   
   2390.
   2391.
   2392.
   2393.
   2394.
   2395.
   2396.
   2397.
   2398.
   2399.
   
   attributes.get('join', None),
   attributes.get('left', None),
   attributes.get('orderby', None),
   attributes.get('groupby', None))
   fields = adapter.expand_all(fields, tablenames)
   return adapter.select(self.query, fields, attributes)
   
   def iterselect(self, *fields, **attributes):
   adapter = self.db._adapter
   tablenames = adapter.tables(self.query,
   
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in select at 
   line 763* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in _select_aux 
   at line 742* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in parse at 
   line 306* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in  
   at line 303* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in _parse at 
   line 232* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\adapters\base.py in parse_value 
   at line 199* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py in parse at 
   line 100* код аргументы переменные
   - 
   
   *File C:\web2py\gluon\packages\dal\pydal\parsers\__init__.py in __call__ 
   at line 75* код аргументы переменные
   - 
   
   *File 

[web2py] Re: Linking GRID records with other records in same GRID

2019-08-09 Thread Sarbjit
Any suggestions ? How can I get to the details page for any grid record 
without clicking on Details button (knowing the grid-id is not sufficient 
as the signature value is unique for every record)

On Wednesday, March 13, 2019 at 10:02:06 AM UTC-4, Sarbjit wrote:
>
> I am using SQLFORM.GRID to display the database records. In my 
> application, certain records may contain the reference to id of other 
> records. Currently, I have to use "search" option to find the record 
> matching reference id.
>
> What I want to do is :- Have a hyperlink in the reference field and then 
> open the details (View button equivalent) for the other record.Problem is 
> View button for each row in GRID has a unique _signature . In the absence 
> of this value, I can't form the hyperlink (view option) for other record. 
>
> How can I get the _signature value associated with GRID records? or is 
> there any way, I can access the Edit Page for a record from the GRID given 
> its ID.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5ac45233-0edc-4d16-9c88-85cf9b3e9632%40googlegroups.com.


Re: [web2py] Como mostrar a imagem no HTML com web2py

2019-08-09 Thread Marco Mansilla
Actually the download method is written in the default controller,  unless
you have written your own function in template.

{{=IMG(_src=URL('default','download', auth_user.foto))}}

Anyway, could you provide the auth_user table definition?, did you add
extra fields?, Since auth_user.foto.file should return an error,
auth_user.foto should be an upload field to return the file name, if it is
a blob field you should put the result in src with no url.

El mar., 6 de ago. de 2019 12:22, Kimus  escribió:

> olha eu aqui dnv  :)
>
> Estou com um problema eu insiro uma imagem no banco mas na hr de mostrar
> no HTML não consigo de jeito nem um, eu nãoi to  usando o template do
> web2py então td pra mim é mais dificil alguem teria algum jeito de fazer
>
> OBS : eu coloquei um campo extra_field no auth_user como foto e queria
> exibir essa foto, só que não utilizo quase nd do que o web2py tem pronto
> tipo sqlform grid essas coisas dai tenho que fazer mais manual a coisa
> alguem teria como me dar uma luz
>
> To tentando algo do genero  tentei usar a função download que ta na
> default só que no meu controller só que ainda não funciona quando salvo a
> imagem ela upa a imagem no upload  tipo auth_user.foto e uma hash só qe não
> consigo fazer funcionar msm alguem me ajuda :(
>
> 
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/9131340d-6d7a-4d8f-bfa1-3fc0b0001ba7%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAEz031eXFvo%2BvbkzG3jWw1QKjm%2B%3D0ByCrRFbG_kYxfsPWO%2BeaA%40mail.gmail.com.