py4web - will it inherit web2py structures ?

123 views
Skip to first unread message

graham

unread,
Oct 13, 2019, 8:23:37 PM10/13/19
to web...@googlegroups.com
I used web2py some years ago and produced a program generator (http://www.web2pyslices.com/slice/show/2060/generator-for-web2py) which met with universal disinterest...

However someone has asked whether it could work with py4web and so I have had a quick look at it. There are minor Python 3 issues which are easily fixed but when I start to look at the web2py interface I immediately come across a problem: the code makes us of the 'current' structure, in particular it uses current.request to obtain the POST data and there appears to be no such structure in py4web.

I have checked the py4web documentation and it does say in the PyDAL chapter, under ;'Model-less applications' "...and provide necessary access to global scope via the current object (as described in Chapter 4)." but Chapter 4 does not contain any details. Perhaps this contains a lot of text from the web2py docs and will have corrections and more py4web content included later.

Obviously this is not of any real relevance to py4web itself but I just wondered whether it is intended that 'current' or an equivalent is or will be available in py4web or is there any simple (because I don't want to take up too much of your time) work around.

Thanks

graham

Massimo Di Pierro

unread,
Oct 13, 2019, 8:26:29 PM10/13/19
to web2py-users
I was not aware of it. Could you post some screen shots? maybe an example of a generated app?
Unless you use grids it should be easy to port it to py4web.

graham

unread,
Oct 14, 2019, 9:03:14 AM10/14/19
to web...@googlegroups.com
I'll certainly give more details when it's working - the original web2pyslices posting was in 2016.

But my problem at the moment is where is 'current.request' ? That was in
from web2py.gluon import current
but despite importing py4web (and pydal) there seems to be no 'current' structure. As I mentioned the documentation isn't really helpful in this.

I'm currently using a 20190929 build (via Pycharm) and py4web itself will run.

graham
On Monday, October 14, 2019, 1:26:36 AM GMT+1, Massimo Di Pierro <massimo....@gmail.com> wrote:


I was not aware of it. Could you post some screen shots? maybe an example of a generated app?
Unless you use grids it should be easy to port it to py4web.

On Sunday, 13 October 2019 17:23:37 UTC-7, graham wrote:
I used web2py some years ago and produced a program generator (http://www.web2pyslices.com/ slice/show/2060/generator-for- web2py) which met with universal disinterest...


However someone has asked whether it could work with py4web and so I have had a quick look at it. There are minor Python 3 issues which are easily fixed but when I start to look at the web2py interface I immediately come across a problem: the code makes us of the 'current' structure, in particular it uses current.request to obtain the POST data and there appears to be no such structure  in py4web.

I have checked the py4web documentation and it does say in the PyDAL chapter, under ;'Model-less applications' "...and provide necessary access to global scope via the current object (as described in Chapter 4)." but Chapter 4 does not contain any details. Perhaps this contains a lot of text from the web2py docs and will have corrections and more py4web content included later.

Obviously this is not of any real relevance to py4web itself but I just wondered whether it is intended that 'current' or an equivalent is or will be available in py4web or is there any simple (because I don't want to take up too much of your time) work around.

Thanks

graham

--
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+un...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/fdf7c91b-a6d3-4bd1-9d32-31c9bd7bdb37%40googlegroups.com
.

Massimo Di Pierro

unread,
Oct 14, 2019, 10:38:40 PM10/14/19
to web2py-users
py4web has no current and does not need it it.

from py4web import request

and just use request in your actions. Mind this is a bottlepy request, not the same as the web2py request object.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscribe@googlegroups.com.

To view this discussion on the web visit

graham

unread,
Oct 15, 2019, 9:33:16 AM10/15/19
to web...@googlegroups.com
Thanks Massimo, that will probably sort it out, I've had a quick look at bottle and should be able to amend the code appropriately.

I'll post again when it appears to be working, which, hopefully, won't be very long

graham



---
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+unsubscribe@ googlegroups.com.
To view this discussion on the web visit

--
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+un...@googlegroups.com.

To view this discussion on the web visit
Reply all
Reply to author
Forward
0 new messages