Pydal upload compatibility with pyfilesystem

66 views
Skip to first unread message

Yangbo Xu

unread,
Nov 17, 2017, 11:09:55 PM11/17/17
to 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

unread,
Nov 24, 2017, 11:55:17 PM11/24/17
to web2py-users
Anyone has any suggestion on some workaround?
Thanks in advance!

Yangbo

Val K

unread,
Nov 25, 2017, 11:58:36 AM11/25/17
to 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

unread,
Nov 26, 2017, 12:47:12 AM11/26/17
to 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
Reply all
Reply to author
Forward
0 new messages