Replace return "Your ip is " + test.ip()
with return str(dir(test)) what do you get? You may be importing the wrong module. On Monday, 23 September 2013 19:45:08 UTC-5, 黄祥 wrote: > > hi, > > i have a function that reuse by another function for example for showing > the grid, i read in this forum that they suggests to put the reusable > function in modules. > i want to learn how to create module in web2py, any references for this? > i'm tried the code in web2py book : > > /test/modules/test.py > from gluon import * > def ip(): return current.request.client > > /test/controllers/default.py > import test > def index(): > return "Your ip is " + test.ip() > > it return an error : > AttributeError: 'module' object has no attribute 'ip' > > thanks and 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/groups/opt_out.