Re: [web2py] Digest for web2py@googlegroups.com - 1 update in 1 topic

29 views
Skip to first unread message

david jensen

unread,
Feb 1, 2020, 4:50:44 PM2/1/20
to web...@googlegroups.com
I do not see an up-to-date web2py reference in  PyPI

On Sat, Feb 1, 2020 at 3:44 PM <web...@googlegroups.com> wrote:
Massimo Di Pierro <massimo....@gmail.com>: Jan 31 08:55PM -0800

I committed some new code to py4web
 
Now you can do:
 
from . common import authenticated, unauthenticated # from latest _scaffold
 
# exposes index as /{app_name}/index and uses index.html or generic.html
template, auth.user, db, T, session
@authenticated()
def index():
return dict()
 
# GET only
@authenticated.get()
def index():
return dict()
 
# exposes /{app_name}/index/<a>/<b>/<c>
@authenticated.get()
def index(a,b,c):
return dict()
 
# more explicit
@authenticated.get("index/<a:int>/<b:int>/<c:re:.*>)
def index(a,b,c):
return dict()
 
Some magic
 
# define a button that make the following serverside POST callback
@unauthenticated.button("click me")
def a_button(msg):
print("you clicked the button and server received:", msg)
 
# expose a page that displays the button which - onclick - makes the
ballback
@unauthenticated.get()
def show_a_button():
return dict(mybutton = a_button(msg="hello world"))
 
Thoughts? Should we keep this API? Can we improve it?
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to web2py+un...@googlegroups.com.


--
David Jensen
Apartment 412
414 w. 120th Street
New York, New York 10027
c646-282-6355
h212-866-7094

Massimo Di Pierro

unread,
Feb 1, 2020, 8:05:43 PM2/1/20
to web2py-users
Not yet. Still making changes. The latest is on github. Will probably post more tomorrow
To unsubscribe from this group and stop receiving emails from it send an email to web2py+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages