Hi
I am trying to call a method in my module but always giving the below
error
Traceback (most recent call last):
File "/home/vikramt/web2py/gluon/restricted.py", line 188, in
restricted
exec ccode in environment
File "/home/vikramt/web2py/applications/myapp/controllers/
default.py", line 64, in <module>
File "/home/vikramt/web2py/gluon/globals.py", line 96, in <lambda>
self._caller = lambda f: f()
File "/home/vikramt/web2py/applications/myapp/controllers/
default.py", line 23, in check
return dict(roles=role.checkrole.mysession(ldap))
AttributeError: 'module' object has no attribute 'checkrole'
I have placed a file checkrole.py in myapp/modules/
checkrole.py
-------------------
class checkrole():
def mysession(name):
username=name
role=db.user(role,ldap=username)
return role
db.py
---------
db=SQLDB('mysql://root:test...@localhost/web')
role=local_import('checkrole')
db.define_table('user',Field('ldap'),Field('role'))
my controller
-------------------
def check():
form=FORM(INPUT(_name='ldap',_type='text'),INPUT(_type='Submit'))
if form.accepts(request.vars):
return dict(roles=role.checkrole.mysession(request.vars.ldap))
return dict(form=form)
my view
------------
{{extend 'layout.html'}}
{{=form}}
{{=roles}}
I have tried all sorts of combinations, but could not able to call the
method or class in the module
Could any one help on this?