Pydal upload compatibility with pyfilesystem

66 visningar
Hoppa till det första olästa meddelandet

Yangbo Xu

oläst,
17 nov. 2017 23:09:552017-11-17
till web2py-users

Hello,


I have a question regarding how Pydal can accept remote filesystem thru pyfilesystem.

According to the web2py documentation

http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor

I need to put uploadfs = # pyfilesystem object in field definition.

 

After doing so, at upload, pyfilesystem complains that “paths must be unicode (not str)”


The source code for pyfilesystem is here (search for "def validatepath")

https://github.com/PyFilesystem/pyfilesystem2/blob/master/fs/base.py

 

So I conclude pydal pass file path in python2 byte string, and pyfilesystem only accepts Unicode in python2.

 

Do you have any suggestion/workaround for this issue?

Thanks in advance.


Yangbo Xu

oläst,
24 nov. 2017 23:55:172017-11-24
till web2py-users
Anyone has any suggestion on some workaround?
Thanks in advance!

Yangbo

Val K

oläst,
25 nov. 2017 11:58:362017-11-25
till web2py-users
I had related issue  -  I tried to stream (response.stream)  file with unicode filename - unsuccessfully (CentOS)
Upload field has custom_store/custom_retrieve  args  - https://groups.google.com/forum/#!topic/web2py/8X-QlbtyxEQ
try to use it 

Yangbo Xu

oläst,
26 nov. 2017 00:47:122017-11-26
till web2py-users
Thank you Val, I will try the custom_store, custom_retrieve out!
Besides, i have also raise a ticket to pyDal at below
Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden