GAE - Getting TypeError requiring class instance be passed to class's own method...
- by Spencer Leland
I'm really new to programming... I set up a class to give supporting information for Google's User API user object. I store this info in the datastore using db.model.
When I call the okstatus method of my user_info class using this code:
elif user_info.okstatus(user):
self.response.out.write("user allowed")
I get this error:
unbound method okstatus() must be called with user_info instance
as first argument (got User instance instead)
Here is my user_info class.
class user_info:
def auth_ctrlr(self, user):
if self.status(user) == status_allowed:
return ("<a href=\"%s\">Sign Out</a>)" %
(users.create_login_url("/")))
else:
return ("<a href=\"%s\">Sign In or Get an Account</a>)" %
(users.create_logout_url("/")))
def status(self, user):
match = sub_user.gql(qu_by_user_id, user.user_id)
return match.string_status
def group(self, user):
match = sub_user.gql(qu_by_user_id, user.user_id)
grp = group_names.gql(qu_by_user_id, match.groupID)
return grp
def okstatus(self, user):
match = self.status(user)
if match == status_allowed:
return True
My understanding is that the argument "self" inside the method's calling arguments describes it as a child to the class. I've tried everything I can think of and can't find any related info online. Can someone please tell me what I'm doing wrong?
Thanks