Okay... I figured it out. I feel kinda stupid. I've been using Python 3 too much apparently and I added "()" to the end of the method when Python 2 didn't like it.
Andrew On Wednesday, May 2, 2012 1:41:01 PM UTC+2, Andrew Cooper wrote: > > Hi. I'm running into a weird error. I've got a function in my controller > that is simply calling a method on an object... like such. > "pagemanager.setIndex()". When it calls this method it gets the error... > "TypeError: setIndex() takes no arguments (1 given)". I'm looking at the > code. I'm not passing any arguments. The method itself only has "self" in > its declaration. > > Here's the error page. > > > Error ticket for "gateway" Ticket ID > > 127.0.0.1.2012-05-02.13-26-47.6582e8b4-5025-4471-aba2-953f9ed2c611 > <type 'exceptions.TypeError'> setIndex() takes no arguments (1 given) > Version web2py™ (1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), > 'stable') Python Python 2.7.3: /usr/bin/python Traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > 10. > > Traceback (most recent call last): > File "/home/andrew/Projects/Gateway - Church > Management/gluon/restricted.py", line 205, in restricted > exec ccode in environment > File "/home/andrew/Projects/Gateway - Church > Management/applications/gateway/controllers/default.py" > <http://127.0.0.1:8000/admin/default/edit/gateway/controllers/default.py>, > line 74, in <module> > File "/home/andrew/Projects/Gateway - Church Management/gluon/globals.py", > line 173, in <lambda> > self._caller = lambda f: f() > File "/home/andrew/Projects/Gateway - Church > Management/applications/gateway/controllers/default.py" > <http://127.0.0.1:8000/admin/default/edit/gateway/controllers/default.py>, > line 15, in index > pagemanager.setIndex() > TypeError: setIndex() takes no arguments (1 given) > > Error snapshot [image: help] > > <type 'exceptions.TypeError'>(setIndex() takes no arguments (1 given)) > > inspect attributes > Frames > > - > > *File /home/andrew/Projects/Gateway - Church > Management/gluon/restricted.py in restricted at line 205* code > arguments variables > - > > *File /home/andrew/Projects/Gateway - Church > Management/applications/gateway/controllers/default.py in <module> at line > 74* code arguments variables > - > > *File /home/andrew/Projects/Gateway - Church > Management/gluon/globals.py in <lambda> at line 173* code arguments > variables > - > > *File /home/andrew/Projects/Gateway - Church > Management/applications/gateway/controllers/default.py in index at line 15 > * code arguments variables > Function argument list > > () > Code listing > > 10. > 11. > 12. > 13. > 14. > 15. > > 16. > 17. > 18. > 19. > > ######################################################################### > from PageManager import * > > def index(): > pagemanager = PageManager() > pagemanager.setIndex() > > return dict(pagemanager=pagemanager) > > def members(): > members = db().select(db.member.ALL, orderby=(db.member.lastname, > db.member.firstname)) > > Variables pagemanager.setIndex <bound method PageManager.setIndex of > <applicati...ateway.modules.PageManager.PageManager instance>> > pagemanager <applications.gateway.modules.PageManager.PageManager > instance> > > Context > > locals request session response > In file: /home/andrew/Projects/Gateway - Church > Management/applications/gateway/controllers/default.py > > 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. > 43. > 44. > 45. > 46. > 47. > 48. > 49. > 50. > 51. > 52. > 53. > 54. > 55. > 56. > 57. > 58. > 59. > 60. > 61. > 62. > 63. > 64. > 65. > 66. > 67. > 68. > 69. > 70. > 71. > 72. > 73. > 74. > 75. > > # -*- coding: utf-8 -*- > # this file is released under public domain and you can use without > limitations > > ######################################################################### > ## This is a samples controller > ## - index is the default action of any application > ## - user is required for authentication and authorization > ## - download is for downloading files uploaded in the db (does streaming) > ## - call exposes all registered services (none by default) > ######################################################################### > from PageManager import * > > def index(): > pagemanager = PageManager() > pagemanager.setIndex() > return dict(pagemanager=pagemanager) > > def members(): > members = db().select(db.member.ALL, orderby=(db.member.lastname, > db.member.firstname)) > return dict(message='Member Management', members=members, menu=menu, > sidebar=sidebar, title='Gateway - Church Management System') > > def user(): > """ > exposes: > http://..../[app]/default/user/login > http://..../[app]/default/user/logout > http://..../[app]/default/user/register > http://..../[app]/default/user/profile > http://..../[app]/default/user/retrieve_password > http://..../[app]/default/user/change_password > 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(), title='Login', menu=[]) > > > def download(): > """ > allows downloading of uploaded files > http://..../[app]/default/download/[filename] > """ > return response > <http://127.0.0.1:8000/examples/global/vars/response>.download(request > <http://127.0.0.1:8000/examples/global/vars/request>,db) > > > def call(): > """ > exposes services. for example: > http://..../[app]/default/call/jsonrpc > decorate with @services.jsonrpc the functions to expose > supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv > """ > return service() > > > @auth.requires_signature() > def data(): > """ > http://..../[app]/default/data/tables > http://..../[app]/default/data/create/[table] > http://..../[app]/default/data/read/[table]/[id] > 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()) > > response <http://127.0.0.1:8000/examples/global/vars/response>._vars=response > <http://127.0.0.1:8000/examples/global/vars/response>._caller(index) > > Powered by web2py <http://www.web2py.com>™ created by Massimo Di Pierro > ©2007-2011 - Admin language > > > As you can see, I'm not passing any arguments. > > Thanks, > > Andrew >

