Lazy is good. You can turn it to your advantage with this:
import functools
def my_awesome_decorator(path=None, method=['GET','POST'],
requires_login=False):
def wrapper(func, path=path, method=method,
requires_login=requires_login):
path = path or func.__name__
template = func._
Lazy is good. You can turn it to your advantage with this:
import functools
def my_awesome_validator(path=None, method=['GET','POST'],
requires_login=False):
def wrapper(func, path=path, method=method):
path = path or func.__name__
template = func.__name__+'.html'
fixtures
Thanks Massimo. I was hoping to avoid having to pass something to the view
every time. I'm lazy, right? I'm assuming that this is the same if I used
response instead of session. In web2py you didn't have to pass response to
the view, it was automatically available.
-Jim
On Tue, Jan 21, 2020 a
I would recommend you do something like this
@action('index')
@action.uses('index.html', session)
def index():
...
return dict(session=dict(session))
This will pass a shallow copy of the session to the view. You will be free
to read from the session in index.html but you should not write
I should re-state my problem. With web2py I wasn't using session, but
response. I added a couple of attributes that always got added to the
response object. Not sure how to mimic that in py4web, or would I even
want to?
-Jim
On Fri, Jan 17, 2020 at 11:16 AM Jim S wrote:
> Hi
>
> I'm trying t
Hi
I'm trying to pass a session variable to layout.html but it tells me that
session is not available:
NameError: name 'session' is not defined
I use this technique in web2py to send a page title to layout.html without
having to pass it in the returned dict from the controller.
Obviously I'm
6 matches
Mail list logo