Error ticket for "demo_app3"

Ticket ID

177.32.48.156.2019-04-23.18-03-19.beeeeb13-a4a3-4512-85cd-cde7e981754c

<type 'exceptions.AttributeError'> 'module' object has no attribute 'pbkdf2_hmac'

Version

web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr)

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
Traceback (most recent call last):
File "/home/mdipierro/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/mdipierro/web2py/applications/demo_app3/controllers/default.py", line 78, in <module>
File "/home/mdipierro/web2py/gluon/globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File "/home/mdipierro/web2py/applications/demo_app3/controllers/default.py", line 40, in user
return dict(form=auth())
File "/home/mdipierro/web2py/gluon/tools.py", line 1801, in __call__
return getattr(self, args[0])()
File "/home/mdipierro/web2py/gluon/tools.py", line 2977, in register
hideerror=self.settings.hideerror):
File "/home/mdipierro/web2py/gluon/sqlhtml.py", line 1989, in accepts
self.vars.id = self.table.insert(**fields)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/objects.py", line 762, in insert
ret = self._db._adapter.insert(self, row.op_values())
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py", line 480, in insert
query = self._insert(table, fields)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py", line 476, in _insert
','.join(self.expand(v, f.type) for f, v in fields))
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py", line 476, in <genexpr>
','.join(self.expand(v, f.type) for f, v in fields))
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py", line 445, in _expand
rv = self.represent(expression, field_type)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py", line 382, in represent
return super(SQLAdapter, self).represent(obj, field_type)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py", line 336, in represent
return self.representer.represent(obj, field_type)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/representers/__init__.py", line 251, in represent
rv = self.get_representer_for_type(field_type)(rv, field_type)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/representers/__init__.py", line 209, in _default
return self.adapt(value)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/representers/__init__.py", line 227, in adapt
value = str(value)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/validators.py", line 2890, in __str__
hashed = simple_hash(self.password, key, salt, digest_alg)
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/validators.py", line 2813, in simple_hash
int(keylen), get_digest(alg)))
File "/home/mdipierro/web2py/gluon/packages/dal/pydal/validators.py", line 2796, in pbkdf2_hex
hmac = hashlib.pbkdf2_hmac(hashfunc().name, to_bytes(data),
AttributeError: 'module' object has no attribute 'pbkdf2_hmac'

Error snapshot help Detailed traceback description

<type 'exceptions.AttributeError'>('module' object has no attribute 'pbkdf2_hmac')

inspect attributes

Exception instance attributes

__getslice__ <method-wrapper '__getslice__' of exceptions.AttributeError object>
__str__ <method-wrapper '__str__' of exceptions.AttributeError object>
__getattribute__ <method-wrapper '__getattribute__' of exceptions.AttributeError object>
__dict__ {}
__sizeof__ <built-in method __sizeof__ of exceptions.AttributeError object>
message "'module' object has no attribute 'pbkdf2_hmac'"
__init__ <method-wrapper '__init__' of exceptions.AttributeError object>
__setattr__ <method-wrapper '__setattr__' of exceptions.AttributeError object>
__reduce_ex__ <built-in method __reduce_ex__ of exceptions.AttributeError object>
__new__ <built-in method __new__ of type object>
__format__ <built-in method __format__ of exceptions.AttributeError object>
__class__ <type 'exceptions.AttributeError'>
__doc__ 'Attribute not found.'
__getitem__ <method-wrapper '__getitem__' of exceptions.AttributeError object>
__setstate__ <built-in method __setstate__ of exceptions.AttributeError object>
__reduce__ <built-in method __reduce__ of exceptions.AttributeError object>
args ("'module' object has no attribute 'pbkdf2_hmac'",)
__subclasshook__ <built-in method __subclasshook__ of type object>
__unicode__ <built-in method __unicode__ of exceptions.AttributeError object>
__delattr__ <method-wrapper '__delattr__' of exceptions.AttributeError object>
__repr__ <method-wrapper '__repr__' of exceptions.AttributeError object>
__hash__ <method-wrapper '__hash__' of exceptions.AttributeError object>

Frames

  • File /home/mdipierro/web2py/gluon/restricted.py in restricted at line 219 code arguments variables

    Function argument list

    (ccode=<code object <module> at 0x7f262a0c0e30, file "/...tions/demo_app3/controllers/default.py", line 13>, environment={'A': <class 'gluon.html.A'>, 'ANY_OF': <class 'pydal.validators.ANY_OF'>, 'ASSIGNJS': <function ASSIGNJS>, 'Auth': <class 'gluon.tools.Auth'>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR': <class 'gluon.html.BR'>, 'BUTTON': <class 'gluon.html.BUTTON'>, 'CAT': <class 'gluon.html.CAT'>, ...}, layer='/home/mdipierro/web2py/applications/demo_app3/controllers/default.py', scode=<code object <module> at 0x7f262a0c0e30, file "/...tions/demo_app3/controllers/default.py", line 13>)

    Code listing
    214.
    215.
    216.
    217.
    218.
    219.
    220.
    221.
    222.
    223.
        if environment is None:
    environment = {}
    environment['__file__'] = layer
    environment['__name__'] = '__restricted__'
    try:
    exec(ccode, environment)
    except HTTP:
    raise
    except
    RestrictedError:
    # do not encapsulate (obfuscate) the original RestrictedError
    Variables
    environment {'A': <class 'gluon.html.A'>, 'ANY_OF': <class 'pydal.validators.ANY_OF'>, 'ASSIGNJS': <function ASSIGNJS>, 'Auth': <class 'gluon.tools.Auth'>, 'B': <class 'gluon.html.B'>, 'BEAUTIFY': <class 'gluon.html.BEAUTIFY'>, 'BODY': <class 'gluon.html.BODY'>, 'BR': <class 'gluon.html.BR'>, 'BUTTON': <class 'gluon.html.BUTTON'>, 'CAT': <class 'gluon.html.CAT'>, ...}
    ccode <code object <module> at 0x7f262a0c0e30, file "/...tions/demo_app3/controllers/default.py", line 13>
  • File /home/mdipierro/web2py/applications/demo_app3/controllers/default.py in <module> at line 78 code arguments variables

    Function argument list

    ()

    Code listing
    67.
    68.
    69.
    70.
    71.
    72.
    73.
    74.
    75.
    76.
        http://..../[app]/default/data/update/[table]/[id]
    http://..../[app]/default/data/delete/[table]/[id]
    http://..../[app]/default/data/select/[table]
    http://..../[app]/default/data/search/[table]
    but URLs must be signed, i.e. linked with
    A('table',_href=URL('data/tables',user_signature=True))
    or with the signed load operator
    LOAD('default','data.load',args='tables',ajax=True,user_signature=True)
    """
    return dict(form=crud())
    Variables
  • File /home/mdipierro/web2py/gluon/globals.py in <lambda> at line 421 code arguments variables

    Function argument list

    (f=<function user>)

    Code listing
    416.
    417.
    418.
    419.
    420.
    421.
    422.
    423.
    424.
    425.
            self.flash = ''            # used by the default view layout
    self.meta = Storage() # used by web2py_ajax.html
    self.menu = [] # used by the default view layout
    self.files = [] # used by web2py_ajax.html
    self._vars = None
    self._caller = lambda f: f()
    self._view_environment = None
    self
    ._custom_commit = None
    self
    ._custom_rollback = None
    self
    .generic_patterns = ['*']
    Variables
    self undefined
    f <function user>
  • File /home/mdipierro/web2py/applications/demo_app3/controllers/default.py in user at line 40 code arguments variables

    Function argument list

    ()

    Code listing
    35.
    36.
    37.
    38.
    39.
    40.
    41.
    42.
    43.
    44.
        use @auth.requires_login()
    @auth.requires_membership('group name')
    @auth.requires_permission('read','table name',record_id)
    to decorate functions that need access control
    """
    return dict(form=auth())

    @cache.action()
    def download():
    """
    Variables
    builtindict <type 'dict'>
    form undefined
    global auth <gluon.tools.Auth object>
  • File /home/mdipierro/web2py/gluon/tools.py in __call__ at line 1801 code arguments variables

    Function argument list

    (self=<gluon.tools.Auth object>)

    Code listing
    1796.
    1797.
    1798.
    1799.
    1800.
    1801.
    1802.
    1803.
    1804.
    1805.
                           'impersonate', 'not_authorized', 'confirm_registration',
    'bulk_register', 'manage_tokens', 'jwt'):
    if len(request.args) >= 2 and args[0] == 'impersonate':
    return getattr(self, args[0])(request.args[1])
    else:
    return getattr(self, args[0])()
    elif args[0] == 'cas' and not self.settings.cas_provider:
    if args(1) == self.settings.cas_actions['login']:
    return self.cas_login(version=2)
    elif args(1) == self.settings.cas_actions['validate']:
    Variables
    self <gluon.tools.Auth object>
    args ['register']
    builtingetattr <built-in function getattr>
  • File /home/mdipierro/web2py/gluon/tools.py in register at line 2977 code arguments variables

    Function argument list

    (self=<gluon.tools.Auth object>, next='/demo_app3/default/index', onvalidation=[], onaccept=[], log='User %(id)s Registered')

    Code listing
    2972.
    2973.
    2974.
    2975.
    2976.
    2977.
    2978.
    2979.
    2980.
    2981.

    table_user.registration_key.default = key
    if form.accepts(request, session if self.csrf_prevention else None,
    formname='register',
    onvalidation=onvalidation,
    hideerror=self.settings.hideerror):
    description = self.messages.group_description % form.vars
    if self.settings.create_user_groups:
    group_id = self.add_group(self.settings.create_user_groups % form.vars, description)
    self.add_membership(group_id, form.vars.id)
    Variables
    self <gluon.tools.Auth object>
    hideerror undefined
    self.settings.hideerror False
    self.settings <Storage {'verify_email_onaccept': [], 'allow_ba...ieve_username_next': '/demo_app3/default/index'}>
  • File /home/mdipierro/web2py/gluon/sqlhtml.py in accepts at line 1989 code arguments variables

    Function argument list

    (self=<gluon.sqlhtml.SQLFORM object>, request_vars=<Storage {'first_name': 'Leonardo', 'last_name':..., 'password': '102030', '_formname': 'register'}>, session=<Storage {'_auth_next': '/demo_app3/default/inde...orage {'version': '61.0', 'name': 'Firefox'}>}>}>, formname='register', keepvalues=False, onvalidation=[], dbio=True, hideerror=False, detect_record_change=False, **kwargs={})

    Code listing
    1984.
    1985.
    1986.
    1987.
    1988.
    1989.
    1990.
    1991.
    1992.
    1993.
                        self.vars.id = self.record[self.id_field_name]
    if fields:
    self.table._db(self.table._id == self.record[
    self.id_field_name]).update(**fields)
    else:
    self.vars.id = self.table.insert(**fields)

    self.accepted = ret
    return ret
    Variables
    self.vars <Storage {'password': <pydal.validators.LazyCryp...two': '102030', 'email': 'llsouza.br@gmail.com'}>
    fields {'email': 'llsouza.br@gmail.com', 'first_name': 'Leonardo', 'last_name': 'Souza', 'password': <pydal.validators.LazyCrypt object>, 'registration_id': '', 'registration_key': 'cb46fe9e-14d8-4129-9e86-a7e01813bf7c', 'reset_password_key': ''}
    self <gluon.sqlhtml.SQLFORM object>
    self.vars.id None
    self.table.insert <bound method Table.insert of <Table auth_user (...ation_key, reset_password_key, registration_id)>>
    self.table <Table auth_user (id, first_name, last_name, ema...ration_key, reset_password_key, registration_id)>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/objects.py in insert at line 762 code arguments variables

    Function argument list

    (self=<Table auth_user (id, first_name, last_name, ema...ration_key, reset_password_key, registration_id)>, **fields={'email': 'llsouza.br@gmail.com', 'first_name': 'Leonardo', 'last_name': 'Souza', 'password': <pydal.validators.LazyCrypt object>, 'registration_id': '', 'registration_key': 'cb46fe9e-14d8-4129-9e86-a7e01813bf7c', 'reset_password_key': ''})

    Code listing
    757.
    758.
    759.
    760.
    761.
    762.
    763.
    764.
    765.
    766.

    def insert(self, **fields):
    row = self._fields_and_values_for_insert(fields)
    if any(f(row) for f in self._before_insert):
    return 0
    ret = self._db._adapter.insert(self, row.op_values())
    if ret and self._after_insert:
    for f in self._after_insert:
    f(row, ret)
    return ret
    Variables
    self <Table auth_user (id, first_name, last_name, ema...ration_key, reset_password_key, registration_id)>
    ret undefined
    row.op_values <bound method OpRow.op_values of <OpRow {'first_...a7e01813bf7c', 'email': 'llsouza.br@gmail.com'}>>
    self._db._adapter <pydal.adapters.sqlite.SQLite object>
    self._db._adapter.insert <bound method SQLite.insert of <pydal.adapters.sqlite.SQLite object>>
    self._db <DAL uri="sqlite://storage.sqlite">
    row <OpRow {'first_name': 'Leonardo', 'last_name': '...-a7e01813bf7c', 'email': 'llsouza.br@gmail.com'}>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py in insert at line 480 code arguments variables

    Function argument list

    (self=<pydal.adapters.sqlite.SQLite object>, table=<Table auth_user (id, first_name, last_name, ema...ration_key, reset_password_key, registration_id)>, fields=[(<pydal.objects.Field object>, 'Leonardo'), (<pydal.objects.Field object>, 'Souza'), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, <pydal.validators.LazyCrypt object>), (<pydal.objects.Field object>, 'cb46fe9e-14d8-4129-9e86-a7e01813bf7c'), (<pydal.objects.Field object>, 'llsouza.br@gmail.com')])

    Code listing
    475.
    476.
    477.
    478.
    479.
    480.
    481.
    482.
    483.
    484.
                    ','.join(el[0]._rname for el in fields),
    ','.join(self.expand(v, f.type) for f, v in fields))
    return self.dialect.insert_empty(table._rname)

    def insert(self, table, fields):
    query = self._insert(table, fields)
    try:
    self.execute(query)
    except:
    e = sys.exc_info()[1]
    Variables
    self._insert <bound method SQLite._insert of <pydal.adapters.sqlite.SQLite object>>
    query undefined
    self <pydal.adapters.sqlite.SQLite object>
    table <Table auth_user (id, first_name, last_name, ema...ration_key, reset_password_key, registration_id)>
    fields [(<pydal.objects.Field object>, 'Leonardo'), (<pydal.objects.Field object>, 'Souza'), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, <pydal.validators.LazyCrypt object>), (<pydal.objects.Field object>, 'cb46fe9e-14d8-4129-9e86-a7e01813bf7c'), (<pydal.objects.Field object>, 'llsouza.br@gmail.com')]
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py in _insert at line 476 code arguments variables

    Function argument list

    (self=<pydal.adapters.sqlite.SQLite object>, table=<Table auth_user (id, first_name, last_name, ema...ration_key, reset_password_key, registration_id)>, fields=[(<pydal.objects.Field object>, 'Leonardo'), (<pydal.objects.Field object>, 'Souza'), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, <pydal.validators.LazyCrypt object>), (<pydal.objects.Field object>, 'cb46fe9e-14d8-4129-9e86-a7e01813bf7c'), (<pydal.objects.Field object>, 'llsouza.br@gmail.com')])

    Code listing
    471.
    472.
    473.
    474.
    475.
    476.
    477.
    478.
    479.
    480.
        def _insert(self, table, fields):
    if fields:
    return self.dialect.insert(
    table._rname,
    ','.join(el[0]._rname for el in fields),
    ','.join(self.expand(v, f.type) for f, v in fields))
    return self.dialect.insert_empty(table._rname)

    def insert(self, table, fields):
    query = self._insert(table, fields)
    Variables
    self.expand <bound method SQLite._expand of <pydal.adapters.sqlite.SQLite object>>
    fields [(<pydal.objects.Field object>, 'Leonardo'), (<pydal.objects.Field object>, 'Souza'), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, ''), (<pydal.objects.Field object>, <pydal.validators.LazyCrypt object>), (<pydal.objects.Field object>, 'cb46fe9e-14d8-4129-9e86-a7e01813bf7c'), (<pydal.objects.Field object>, 'llsouza.br@gmail.com')]
    self <pydal.adapters.sqlite.SQLite object>
    f undefined
    v undefined
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py in <genexpr> at line 476 code arguments variables

    Function argument list

    ((f=<pydal.objects.Field object>, v=<pydal.validators.LazyCrypt object>))

    Code listing
    471.
    472.
    473.
    474.
    475.
    476.
    477.
    478.
    479.
    480.
        def _insert(self, table, fields):
    if fields:
    return self.dialect.insert(
    table._rname,
    ','.join(el[0]._rname for el in fields),
    ','.join(self.expand(v, f.type) for f, v in fields))
    return self.dialect.insert_empty(table._rname)

    def insert(self, table, fields):
    query = self._insert(table, fields)
    Variables
    f <pydal.objects.Field object>
    fields undefined
    self <pydal.adapters.sqlite.SQLite object>
    f.type 'password'
    v <pydal.validators.LazyCrypt object>
    self.expand <bound method SQLite._expand of <pydal.adapters.sqlite.SQLite object>>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py in _expand at line 445 code arguments variables

    Function argument list

    (self=<pydal.adapters.sqlite.SQLite object>, expression=<pydal.validators.LazyCrypt object>, field_type='password', colnames=False, query_env={})

    Code listing
    440.
    441.
    442.
    443.
    444.
    445.
    446.
    447.
    448.
    449.
                        op = op[:-1]
    rv = '(%s)' % op
    else:
    rv = op()
    elif field_type:
    rv = self.represent(expression, field_type)
    elif isinstance(expression, (list, tuple)):
    rv = ','.join(self.represent(item, field_type)
    for item in expression)
    elif isinstance(expression, bool):
    Variables
    field_type 'password'
    self.represent <bound method SQLite.represent of <pydal.adapters.sqlite.SQLite object>>
    expression <pydal.validators.LazyCrypt object>
    rv undefined
    self <pydal.adapters.sqlite.SQLite object>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py in represent at line 382 code arguments variables

    Function argument list

    (self=<pydal.adapters.sqlite.SQLite object>, obj=<pydal.validators.LazyCrypt object>, field_type='password')

    Code listing
    377.
    378.
    379.
    380.
    381.
    382.
    383.
    384.
    385.
    386.
            self.execute('SELECT 1;')

    def represent(self, obj, field_type):
    if isinstance(obj, (Expression, Field)):
    return str(obj)
    return super(SQLAdapter, self).represent(obj, field_type)

    def adapt(self, obj):
    return "'%s'" % obj.replace("'", "''")
    Variables
    field_type 'password'
    obj <pydal.validators.LazyCrypt object>
    self <pydal.adapters.sqlite.SQLite object>
    global SQLAdapter <class 'pydal.adapters.base.SQLAdapter'>
    ).represent <bound method SQLite.represent of <pydal.adapters.sqlite.SQLite object>>
    builtinsuper <type 'super'>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/adapters/base.py in represent at line 336 code arguments variables

    Function argument list

    (self=<pydal.adapters.sqlite.SQLite object>, obj=<pydal.validators.LazyCrypt object>, field_type='password')

    Code listing
    331.
    332.
    333.
    334.
    335.
    336.
    337.
    338.
    339.
    340.
            return value

    def represent(self, obj, field_type):
    if isinstance(obj, CALLABLETYPES):
    obj = obj()
    return self.representer.represent(obj, field_type)

    def _drop_table_cleanup(self, table):
    del self.db[table._tablename]
    del self.db.tables[self.db.tables.index(table._tablename)]
    Variables
    self.representer <pydal.representers.sqlite.SQLiteRepresenter object>
    self <pydal.adapters.sqlite.SQLite object>
    self.representer.represent <bound method SQLiteRepresenter.represent of <pydal.representers.sqlite.SQLiteRepresenter object>>
    obj <pydal.validators.LazyCrypt object>
    field_type 'password'
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/representers/__init__.py in represent at line 251 code arguments variables

    Function argument list

    (self=<pydal.representers.sqlite.SQLiteRepresenter object>, value=<pydal.validators.LazyCrypt object>, field_type='password')

    Code listing
    246.
    247.
    248.
    249.
    250.
    251.
    252.
    253.
    254.
    255.
            if pre_end:
    return value
    repr_type, rv = self.get_representer_for_instance(value)(
    value, field_type)
    if repr_type:
    rv = self.get_representer_for_type(field_type)(rv, field_type)
    return rv


    from .base import BaseRepresenter, SQLRepresenter, NoSQLRepresenter
    Variables
    field_type 'password'
    rv <pydal.validators.LazyCrypt object>
    self <pydal.representers.sqlite.SQLiteRepresenter object>
    self.get_representer_for_type <bound method SQLiteRepresenter.get_representer_...al.representers.sqlite.SQLiteRepresenter object>>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/representers/__init__.py in _default at line 209 code arguments variables

    Function argument list

    (self=<pydal.representers.sqlite.SQLiteRepresenter object>, value=<pydal.validators.LazyCrypt object>, field_type='password')

    Code listing
    204.
    205.
    206.
    207.
    208.
    209.
    210.
    211.
    212.
    213.
            pres.sort(key=lambda x: x._inst_count_)
    for pre in pres:
    self._pre_registry_.append(PreMethodWrapper(self, pre))

    def _default(self, value, field_type):
    return self.adapt(value)

    def _default_instance(self, value, field_type):
    return True, value
    Variables
    self <pydal.representers.sqlite.SQLiteRepresenter object>
    self.adapt <bound method SQLiteRepresenter.adapt of <pydal.representers.sqlite.SQLiteRepresenter object>>
    value <pydal.validators.LazyCrypt object>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/representers/__init__.py in adapt at line 227 code arguments variables

    Function argument list

    (self=<pydal.representers.sqlite.SQLiteRepresenter object>, value=<pydal.validators.LazyCrypt object>)

    Code listing
    222.
    223.
    224.
    225.
    226.
    227.
    228.
    229.
    230.
    231.
            return self.registered_t[key]

    def adapt(self, value):
    if PY2:
    if not isinstance(value, string_types):
    value = str(value)
    value = to_bytes(value)
    try:
    value.decode(self.adapter.db_codec)
    except:
    Variables
    builtinstr <type 'str'>
    value <pydal.validators.LazyCrypt object>
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/validators.py in __str__ at line 2890 code arguments variables

    Function argument list

    (self=<pydal.validators.LazyCrypt object>)

    Code listing
    2885.
    2886.
    2887.
    2888.
    2889.
    2890.
    2891.
    2892.
    2893.
    2894.
                    salt = str(uuid.uuid4()).replace('-', '')[-16:]
    else:
    salt = self.crypt.salt
    else:
    salt = ''
    hashed = simple_hash(self.password, key, salt, digest_alg)
    self.crypted = '%s$%s$%s' % (digest_alg, salt, hashed)
    return self.crypted

    def __eq__(self, stored_password):
    Variables
    digest_alg 'pbkdf2(1000,20,sha512)'
    global simple_hash <function simple_hash>
    self <pydal.validators.LazyCrypt object>
    self.password '102030'
    hashed undefined
    key ''
    salt '9217828dc35bf85b'
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/validators.py in simple_hash at line 2813 code arguments variables

    Function argument list

    (text='102030', key='', salt='9217828dc35bf85b', digest_alg='pbkdf2(1000,20,sha512)')

    Code listing
    2808.
    2809.
    2810.
    2811.
    2812.
    2813.
    2814.
    2815.
    2816.
    2817.
        elif not isinstance(digest_alg, str):  # manual approach
    h = digest_alg(text + key + salt)
    elif digest_alg.startswith('pbkdf2'): # latest and coolest!
    iterations, keylen, alg = digest_alg[7:-1].split(',')
    return to_native(pbkdf2_hex(text, salt, int(iterations),
    int(keylen), get_digest(alg)))
    elif key: # use hmac
    digest_alg = get_digest(digest_alg)
    h = hmac.new(key + salt, text, digest_alg)
    else: # compatible with third party systems
    Variables
    global get_digest <function get_digest>
    builtinint <type 'int'>
    keylen '20'
    alg 'sha512'
  • File /home/mdipierro/web2py/gluon/packages/dal/pydal/validators.py in pbkdf2_hex at line 2796 code arguments variables

    Function argument list

    (data='102030', salt='9217828dc35bf85b', iterations=1000, keylen=20, hashfunc=<built-in function openssl_sha512>)

    Code listing
    2791.
    2792.
    2793.
    2794.
    2795.
    2796.
    2797.
    2798.
    2799.
    2800.
            return v


    def pbkdf2_hex(data, salt, iterations=1000, keylen=24, hashfunc=None):
    hashfunc = hashfunc or hashlib.sha1
    hmac = hashlib.pbkdf2_hmac(hashfunc().name, to_bytes(data),
    to_bytes(salt), iterations, keylen)
    return binascii.hexlify(hmac)

    Variables
    global hmac <module 'hmac' from '/usr/lib/python2.7/hmac.pyc'>
    salt '9217828dc35bf85b'
    data '102030'
    hashlib.pbkdf2_hmac undefined
    ).name undefined
    global hashlib <module 'hashlib' from '/usr/lib/python2.7/hashlib.pyc'>
    iterations 1000
    global to_bytes <function to_bytes>
    hashfunc <built-in function openssl_sha512>
    keylen 20

Context

locals request session response

locals

data:
'102030'
hashfunc:
<built-in function openssl_sha512>
iterations:
1000
keylen:
20
salt:
'9217828dc35bf85b'

request

ajax:
False
application:
demo_app3
args:
register
cid:
None
client:
177.32.48.156
controller:
default
cookies:
session_id_demo_app1:
177.32.48.156-dd8a4120-968a-4841-830d-0981b80b5fd9
comment:
domain:
expires:
httponly:
max-age:
path:
samesite:
secure:
version:
session_id_demo_app2:
177.32.48.156-9e70e2bb-135d-41c2-a129-c89ce9bfe199
comment:
domain:
expires:
httponly:
max-age:
path:
samesite:
secure:
version:
session_id_demo_app3:
177.32.48.156-60749314-fd6b-4de2-ad3f-84dabab1124d
comment:
domain:
expires:
httponly:
max-age:
path:
samesite:
secure:
version:
env:
CONTENT_LENGTH:
1090
CONTENT_TYPE:
multipart/form-data; boundary=---------------------------151877628521337673471454387371
DOCUMENT_ROOT:
/usr/local/openresty/nginx/html
HTTP_ACCEPT:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING:
gzip, deflate
HTTP_ACCEPT_LANGUAGE:
en-GB,en;q=0.5
HTTP_CONNECTION:
close
HTTP_CONTENT_LENGTH:
1090
HTTP_CONTENT_TYPE:
multipart/form-data; boundary=---------------------------151877628521337673471454387371
HTTP_COOKIE:
session_id_demo_app1=177.32.48.156-dd8a4120-968a-4841-830d-0981b80b5fd9; session_id_demo_app2=177.32.48.156-9e70e2bb-135d-41c2-a129-c89ce9bfe199; session_id_demo_app3=177.32.48.156-60749314-fd6b-4de2-ad3f-84dabab1124d
HTTP_HOST:
web2py.com
HTTP_REFERER:
http://web2py.com/demo_app3/default/user/register?_next=%2Fdemo_app3%2Fdefault%2Findex
HTTP_UPGRADE_INSECURE_REQUESTS:
1
HTTP_USER_AGENT:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0
HTTP_X_FORWARDED_FOR:
177.32.48.156
HTTP_X_REAL_IP:
177.32.48.156
PATH_INFO:
/demo_app3/default/user/register
QUERY_STRING:
_next=%2Fdemo_app3%2Fdefault%2Findex
REMOTE_ADDR:
10.0.0.162
REMOTE_PORT:
52838
REQUEST_METHOD:
POST
REQUEST_URI:
/demo_app3/default/user/register?_next=%2Fdemo_app3%2Fdefault%2Findex
SCRIPT_NAME:
SERVER_NAME:
web2py.com
SERVER_PORT:
80
SERVER_PROTOCOL:
HTTP/1.1
app_folders:
set(['/home/mdipierro/web2py/applications/poweredby', '/home/mdipierro/web2py/applications/demo_admin', '/home/mdipierro/web2py/applications/books', '/home/mdipierro/web2py/applications/AlterEgo', '/home/mdipierro/web2py/applications/book', '/home/mdipierro/web2py/applications/demo_app1', '/home/mdipierro/web2py/applications/layouts', '/home/mdipierro/web2py/applications/demo_app3', '/home/mdipierro/web2py/applications/appliances', '/home/mdipierro/web2py/applications/init', '/home/mdipierro/web2py/applications/demo_app2', '/home/mdipierro/web2py/applications/examples', '/home/mdipierro/web2py/applications/admin'])
applications_parent:
/home/mdipierro/web2py
content_length:
1090
content_type:
multipart/form-data; boundary=---------------------------151877628521337673471454387371
db_sessions:
set([])
debugging:
False
document_root:
/usr/local/openresty/nginx/html
gluon_parent:
/home/mdipierro/web2py
http_accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
http_accept_encoding:
gzip, deflate
http_accept_language:
en-GB,en;q=0.5
http_connection:
close
http_content_length:
1090
http_content_type:
multipart/form-data; boundary=---------------------------151877628521337673471454387371
http_cookie:
session_id_demo_app1=177.32.48.156-dd8a4120-968a-4841-830d-0981b80b5fd9; session_id_demo_app2=177.32.48.156-9e70e2bb-135d-41c2-a129-c89ce9bfe199; session_id_demo_app3=177.32.48.156-60749314-fd6b-4de2-ad3f-84dabab1124d
http_host:
web2py.com
http_referer:
http://web2py.com/demo_app3/default/user/register?_next=%2Fdemo_app3%2Fdefault%2Findex
http_upgrade_insecure_requests:
1
http_user_agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0
http_x_forwarded_for:
177.32.48.156
http_x_real_ip:
177.32.48.156
is_jython:
False
is_py2:
True
is_pypy:
False
is_source:
True
local_hosts:
web2py.com
35.173.69.207
::ffff:127.0.0.1
::1
glenn-liveweb6
localhost
127.0.0.1
path_info:
/demo_app3/default/user/register
query_string:
_next=%2Fdemo_app3%2Fdefault%2Findex
remote_addr:
10.0.0.162
remote_port:
52838
request_method:
POST
request_uri:
/demo_app3/default/user/register?_next=%2Fdemo_app3%2Fdefault%2Findex
script_name:
server_name:
web2py.com
server_port:
80
server_protocol:
HTTP/1.1
uwsgi.node:
glenn-liveweb6
uwsgi.version:
2.0.17.1
uwsgi_node:
glenn-liveweb6
uwsgi_version:
2.0.17.1
web2py_original_uri:
/demo_app3/default/user/register?_next=%2Fdemo_app3%2Fdefault%2Findex
web2py_path:
/home/mdipierro/web2py
web2py_version:
2.18.5-stable+timestamp.2019.04.08.04.22.03
wsgi.errors:
<uwsgi_file__bin_user_wsgi_wrapper.ErrorLogFile object at 0x7f2642f0f3d0>
wsgi.file_wrapper:
<built-in function uwsgi_sendfile>
wsgi.input:
<uwsgi._Input object at 0x7f262daa08b8>
wsgi.multiprocess:
True
wsgi.multithread:
False
wsgi.run_once:
False
wsgi.url_scheme:
http
wsgi.version:
1
0
wsgi_errors:
<uwsgi_file__bin_user_wsgi_wrapper.ErrorLogFile object at 0x7f2642f0f3d0>
wsgi_file_wrapper:
<built-in function uwsgi_sendfile>
wsgi_input:
<uwsgi._Input object at 0x7f262daa08b8>
wsgi_multiprocess:
True
wsgi_multithread:
False
wsgi_run_once:
False
wsgi_url_scheme:
http
wsgi_version:
1
0
extension:
html
folder:
/home/mdipierro/web2py/applications/demo_app3
function:
user
global_settings:
app_folders:
set(['/home/mdipierro/web2py/applications/poweredby', '/home/mdipierro/web2py/applications/demo_admin', '/home/mdipierro/web2py/applications/books', '/home/mdipierro/web2py/applications/AlterEgo', '/home/mdipierro/web2py/applications/book', '/home/mdipierro/web2py/applications/demo_app1', '/home/mdipierro/web2py/applications/layouts', '/home/mdipierro/web2py/applications/demo_app3', '/home/mdipierro/web2py/applications/appliances', '/home/mdipierro/web2py/applications/init', '/home/mdipierro/web2py/applications/demo_app2', '/home/mdipierro/web2py/applications/examples', '/home/mdipierro/web2py/applications/admin'])
applications_parent:
/home/mdipierro/web2py
db_sessions:
set([])
debugging:
False
gluon_parent:
/home/mdipierro/web2py
is_jython:
False
is_py2:
True
is_pypy:
False
is_source:
True
local_hosts:
web2py.com
35.173.69.207
::ffff:127.0.0.1
::1
glenn-liveweb6
localhost
127.0.0.1
web2py_version:
2.18.5-stable+timestamp.2019.04.08.04.22.03
is_https:
False
is_local:
False
is_restful:
False
is_scheduler:
False
is_shell:
False
method:
POST
now:
datetime.datetime(2019, 4, 23, 18, 3, 19, 91375)
raw_args:
register
raw_extension:
None
url:
/demo_app3/default/user/register
utcnow:
datetime.datetime(2019, 4, 23, 18, 3, 19, 91389)
wsgi:
<gluon.main.LazyWSGI object at 0x7f262a55b490>

session

response

body:
<cStringIO.StringO object at 0x7f262a553378>
cookies:
session_id_demo_app3:
177.32.48.156-60749314-fd6b-4de2-ad3f-84dabab1124d
comment:
domain:
expires:
httponly:
max-age:
path:
/
samesite:
secure:
version:
delimiters:
{{
}}
files:
flash:
form_label_separator:
:
formstyle:
table3cols
generic_patterns:
google_analytics_id:
None
headers:
X-Powered-By:
web2py
logo:
menu:
Home
False
/demo_app3/default/index
web2py
False
http://web2py.com
My Sites
False
/demo_admin/default/site
This App
False
/demo_admin/default/design/demo_app3
[(<lazyT 'Controller'>, False, '/demo_admin/default/edit/demo_app3/controllers/default.py'), (<lazyT 'View'>, False, '/demo_admin/default/edit/demo_app3/views/default/user.html'), (<lazyT 'Layout'>, False, '/demo_admin/default/edit/demo_app3/views/layout.html'), (<lazyT 'Stylesheet'>, False, '/demo_admin/default/edit/demo_app3/static/css/web2py.css'), (<lazyT 'DB Model'>, False, '/demo_admin/default/edit/demo_app3/models/db.py'), (<lazyT 'Menu Model'>, False, '/demo_admin/default/edit/demo_app3/models/menu.py'), (<lazyT 'Database'>, False, '/demo_app3/appadmin/index'), (<lazyT 'Errors'>, False, '/demo_admin/default/errors/demo_app3'), (<lazyT 'About'>, False, '/demo_admin/default/about/demo_app3')]
web2py.com
False
http://www.web2py.com
[(<lazyT 'Download'>, False, 'http://www.web2py.com/examples/default/download'), (<lazyT 'Support'>, False, 'http://www.web2py.com/examples/default/support'), (<lazyT 'Demo'>, False, 'http://web2py.com/demo_admin'), (<lazyT 'Quick Examples'>, False, 'http://web2py.com/examples/default/examples'), (<lazyT 'FAQ'>, False, 'http://web2py.com/AlterEgo'), (<lazyT 'Videos'>, False, 'http://www.web2py.com/examples/default/videos/'), (<lazyT 'Free Applications'>, False, 'http://web2py.com/appliances'), (<lazyT 'Plugins'>, False, 'http://web2py.com/plugins'), (<lazyT 'Layouts'>, False, 'http://web2py.com/layouts'), (<lazyT 'Recipes'>, False, 'http://web2pyslices.com/'), (<lazyT 'Semantic'>, False, 'http://web2py.com/semantic')]
Documentation
False
http://www.web2py.com/book
[(<lazyT 'Preface'>, False, 'http://www.web2py.com/book/default/chapter/00'), (<lazyT 'Introduction'>, False, 'http://www.web2py.com/book/default/chapter/01'), (<lazyT 'Python'>, False, 'http://www.web2py.com/book/default/chapter/02'), (<lazyT 'Overview'>, False, 'http://www.web2py.com/book/default/chapter/03'), (<lazyT 'The Core'>, False, 'http://www.web2py.com/book/default/chapter/04'), (<lazyT 'The Views'>, False, 'http://www.web2py.com/book/default/chapter/05'), (<lazyT 'Database'>, False, 'http://www.web2py.com/book/default/chapter/06'), (<lazyT 'Forms and Validators'>, False, 'http://www.web2py.com/book/default/chapter/07'), (<lazyT 'Email and SMS'>, False, 'http://www.web2py.com/book/default/chapter/08'), (<lazyT 'Access Control'>, False, 'http://www.web2py.com/book/default/chapter/09'), (<lazyT 'Services'>, False, 'http://www.web2py.com/book/default/chapter/10'), (<lazyT 'Ajax Recipes'>, False, 'http://www.web2py.com/book/default/chapter/11'), (<lazyT 'Components and Plugins'>, False, 'http://www.web2py.com/book/default/chapter/12'), (<lazyT 'Deployment Recipes'>, False, 'http://www.web2py.com/book/default/chapter/13'), (<lazyT 'Other Recipes'>, False, 'http://www.web2py.com/book/default/chapter/14'), (<lazyT 'Buy this book'>, False, 'http://stores.lulu.com/web2py')]
Community
False
None
[(<lazyT 'Groups'>, False, 'http://www.web2py.com/examples/default/usergroups'), (<lazyT 'Twitter'>, False, 'http://twitter.com/web2py'), (<lazyT 'Live Chat'>, False, 'http://webchat.freenode.net/?channels=web2py')]
Plugins
False
None
[('plugin_wiki', False, 'http://web2py.com/examples/default/download'), (<lazyT 'Other Plugins'>, False, 'http://web2py.com/plugins'), (<lazyT 'Layout Plugins'>, False, 'http://web2py.com/layouts')]
meta:
author:
Your Name <you@example.com>
description:
a cool new app
generator:
Web2py Web Framework
keywords:
web2py, python, framework
models_to_run:
^\w+\.py$
^default/\w+\.py$
^default/user/\w+\.py$
postprocessing:
session_client:
177.32.48.156
session_cookie_compression_level:
None
session_cookie_expires:
None
session_data_name:
session_data_demo_app3
session_file:
<open file '/home/mdipierro/web2py/applications/demo_app3/sessions/1a6/15f/177.32.48.156-60749314-fd6b-4de2-ad3f-84dabab1124d', mode 'rb+' at 0x7f262a5abdb0>
session_filename:
/home/mdipierro/web2py/applications/demo_app3/sessions/177.32.48.156-60749314-fd6b-4de2-ad3f-84dabab1124d
session_hash:
ecdb9d2f506dcfa66b342bfb3c200e71
session_id:
177.32.48.156-60749314-fd6b-4de2-ad3f-84dabab1124d
session_id_name:
session_id_demo_app3
session_locked:
True
session_masterapp:
demo_app3
session_new:
False
session_storage_type:
file
status:
200
subtitle:
title:
Demo App3
view:
default/user.html

In file: /home/mdipierro/web2py/applications/demo_app3/controllers/default.py

1.
<code object <module> at 0x7f262a0c0e30, file "/home/mdipierro/web2py/applications/demo_app3/controllers/default.py", line 13>