суббота, 11 мая 2019 г., 5:12:26 UTC+3 пользователь Val K написал:
>
> As result of experimenting with Rapydscript I want to present my 
> alternative web IDE for web2py, 
> (that could be easily ported to web3py as well)
> https://github.com/valq7711/vue2pyj
>
> Any feedback is appreciated
>

  Hi! 

very interesting program, thanks !

to run it on localhost with python 3.7.3 (web2py Version 
2.18.5-stable+timestamp.2019.04.08.04.22.03)
I added to the file  vue2pyj/modules/fs2json.py

two func:

def to_bytes(data, enc="utf8"):
    if data is None:
        return b""
    if isinstance(data, str):
        return bytes(data, enc)  # data.encode('utf8')
    if isinstance(data, dict):
        return dict(map(to_bytes, data.items()))
    if isinstance(data, tuple):
        return map(to_bytes, data)
    if isinstance(data, list):
        return list(map(to_bytes, data))
    return data


def to_str(data, enc="utf8", err="strict"):  # bytes to str
    if data is None:
        return str("")
    if isinstance(data, bytes):
        return data.decode(enc, err)
    if isinstance(data, dict):
        return dict(map(to_str, data.items()))
    if isinstance(data, tuple):
        return map(to_str, data)
    if isinstance(data, list):
        return list(map(to_str, data))
    return data

and was changed lines
1)
                ctime = stat.st_ctime * 1000,
                mtime = stat.st_mtime * 1000,
                #ctime = long(stat.st_ctime * 1000),
                #mtime = long(stat.st_mtime * 1000),
2)
        ret = f.read()
    return to_str(ret)
3)
    content =  to_bytes( fdata.get('content', '') )
    #content =  unicode.encode(fdata.get('content', ''), 'utf8')
------------------------------------

vue2pyj works, unfortunately web2py reports

ERROR:Rocket.Errors.Thread-5:Traceback (most recent call last):

  File "/home/w3p/web2py/gluon/rocket.py", line 1288, in run
    self.run_app(conn)

  File "/home/w3p/web2py/gluon/rocket.py", line 1781, in run_app
    self.environ = environ = self.build_environ(sock_file, conn)

  File "/home/w3p/web2py/gluon/rocket.py", line 1601, in build_environ
    request = self.read_request_line(sock_file)

  File "/home/w3p/web2py/gluon/rocket.py", line 1339, in read_request_line
    d = sock_file.readline()

  File "/home/w3p/anaconda3/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)

ConnectionResetError: [Errno 104] Connection reset by peer

ERROR:Rocket.Errors.Thread-5:Tried to send "500 Server Error" to client but 
received socket error



Alex

-- 
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/d96bad10-4e57-4049-a6da-ac828a010649%40googlegroups.com.

Reply via email to