*_scaffold/controllers.py*
@action('index', method='GET')                # the function below is 
exposed as index.html
@action.uses('generic.html', session, db, T)  # it uses the generic.html 
template, a session, and the db
def index():
    T.select('id')
    session['counter'] = session.get('counter', 0) + 1
    msg = T('Hello World from {name}')
    return dict(message=msg.format(name=session['counter'] ) )

*_scaffold/requirements.txt*
python-memcached
redis

change the value of settings.py for session only work with cookies and 
database, for testing session with redis and memcache, every error occured, 
stop the server, change the settings.py then start the server again, 
refresh the page.

*test redis session with password in redis.conf*
ERROR:root:Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 353, in 
wrapper
    ret = func(*func_args, **func_kwargs)
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 321, in 
wrapper
    [obj.on_request() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 321, in 
<listcomp>
    [obj.on_request() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 266, in 
on_request
    self.load()
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 231, in load
    json_data = self.storage.get(cookie_data)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/redis/client.py"
, line 1264, in get
    return self.execute_command('GET', name)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/redis/client.py"
, line 775, in execute_command
    return self.parse_response(connection, command_name, **options)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/redis/client.py"
, line 789, in parse_response
    response = connection.read_response()
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/redis/connection.py"
, line 642, in read_response
    raise response
redis.exceptions.ResponseError: NOAUTH Authentication required.

id= 2

*test redis session without password in redis.conf*
ERROR:root:Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 325, in 
wrapper
    [obj.on_success() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 325, in 
<listcomp>
    [obj.on_success() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 274, in 
on_success
    self.save()
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 250, in save
    self.storage.set(cookie_data, json.dumps(self.local.data), self.
expiration)
  File 
"/Users/sugizo/learn/python/web3py/applications/_scaffold/controllers.py", 
line 18, in <lambda>
    conn.set = lambda key, value, expire, c=conn: (c.set(key,value), c.ttl(
expiration))
TypeError: <lambda>() missing 1 required positional argument: 'expire'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 353, in 
wrapper
    ret = func(*func_args, **func_kwargs)
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 328, in 
wrapper
    [obj.on_error() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 328, in 
<listcomp>
    [obj.on_error() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 270, in 
on_error
    self.save()
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 250, in save
    self.storage.set(cookie_data, json.dumps(self.local.data), self.
expiration)
  File 
"/Users/sugizo/learn/python/web3py/applications/_scaffold/controllers.py", 
line 18, in <lambda>
    conn.set = lambda key, value, expire, c=conn: (c.set(key,value), c.ttl(
expiration))
TypeError: <lambda>() missing 1 required positional argument: 'expire'

id= 3

*test memcache session*
ERROR:root:Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 325, in 
wrapper
    [obj.on_success() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 325, in 
<listcomp>
    [obj.on_success() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 274, in 
on_success
    self.save()
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 250, in save
    self.storage.set(cookie_data, json.dumps(self.local.data), self.
expiration)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/memcache.py"
, line 727, in set
    return self._set("set", key, val, time, min_compress_len, noreply)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/memcache.py"
, line 1052, in _set
    return _unsafe_set()
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/memcache.py"
, line 1036, in _unsafe_set
    headers = "%d %d %d" % (flags, time, len_val)
TypeError: %d format: a number is required, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 353, in 
wrapper
    ret = func(*func_args, **func_kwargs)
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 328, in 
wrapper
    [obj.on_error() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 328, in 
<listcomp>
    [obj.on_error() for obj in fixtures]
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 270, in 
on_error
    self.save()
  File "/Users/sugizo/learn/python/web3py/web3py/core.py", line 250, in save
    self.storage.set(cookie_data, json.dumps(self.local.data), self.
expiration)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/memcache.py"
, line 727, in set
    return self._set("set", key, val, time, min_compress_len, noreply)
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/memcache.py"
, line 1052, in _set
    return _unsafe_set()
  File 
"/Users/sugizo/miniconda3/envs/python3_test/lib/python3.7/site-packages/memcache.py"
, line 1036, in _unsafe_set
    headers = "%d %d %d" % (flags, time, len_val)
TypeError: %d format: a number is required, not NoneType

id= 4

is the id on the bottom of error traceback is the id for error traceback 
that record in database ?

best regards,
stifan

-- 
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