My reasoning so far is that the best way to do this is:

Step 1: parse a view.html file to extract the python code between "{{" and 
"}}" and output it to a file view.html.py where "{{" and "}}" are replaced 
with comments like:
#1
if bla:
#/1
#2
pass
#/2
Step 2: create a view3.html where "{{" and "}}" are replaced with #1 and 
#/1, next ones with #2 and #/2, etc
Step 3: properly format the view.html.py file, and this something I don't 
know how to do, but clearly web2py does so that the code is properly 
interpreted
Step 4: run 2to3 over that file
Step 5: compose a new view.html by parsing view3.html replacing code 
between the first #1 and #/1 with the new (2to3 generated) code of 
view.html.py between #1 and #/1

On Sunday, April 14, 2019 at 1:26:18 PM UTC+3, Octavian G wrote:
>
> Hello group,
>
>      I've started porting a large app from Python2 to Python3. I've used 
> 2to3 and some manual work to convert models, controllers and modules to 
> Python3 but now I got to the views and I'm stumped.
>
>      Basically, I think I would need a way to isolate the python code from 
> the views so I can run 2to3 over it.. any ideas ?  I know there's some 
> magic being done so the code is interpreted inside the tags, do the main 
> contributors to web2py have any pointer / idea / hack / dirty unspeakable 
> technique that could help this one-time conversion ?
>
>      Apologies if this problem has been handled before in the group, I 
> didn't find such a thread, so if you know one exists, please suggest some 
> keywords for search.
>
>      Otherwise, I think solving this problem would immensely contribute to 
> older apps being ported to Python3 for web2py.
>
>      Thanks for reading.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to