Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:04:38+00:00 2026-06-03T12:04:38+00:00

The following code is close to what I am using without getting too long.

  • 0

The following code is close to what I am using without getting too long. I get the error TypeError: is_valid() takes exactly 2 arguments (3 given). To my eyes I am only passing 2 arguments. So where is the third argument coming from?

models/MyModel.py

from google.appengine.ext import db

class MyModel(db.model):
    a = db.StringProperty(required=True)
    b = db.StringProperty(required=True)
    c = db.StringProperty(required=True)

class Update:
    def is_valid(x, y)
        myquery = db.GqlQuery('SELECT * FROM Valid WHERE value = :1' x)
        v = myquery.get()

        if v.something == y:
            yet_more_stuff
            return(True)
        else:
            return(False)

controllers/WebHandler.py

import webapp2
from models.MyModel import Update

class WebHandler(webapp2.RequestHandler):
    def get(self):
        var_x = "string"
        var_y = "string"
        z = Update()
        if z.is_valid(var_x, var_y): <----- line error occurs
            do_some_stuff
        else
            do_some_other_stuff

It is probably something simple but after coding for 18 hours today my brain has turned into oatmeal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:04:39+00:00Added an answer on June 3, 2026 at 12:04 pm

    Solution

    You have two solutions:

    • add an argument representing instance in the method definition (name it self for consistency), or
    • use staticmethod decorator on the method.

    Explanation and examples

    This line:

    def is_valid(x, y):
    

    means that when the method is called, x is the class instance and y is the argument. If you wanted to accept two arguments (and the instance itself), your line should look like that:

    def is_valid(self, x, y)
    

    But because you are not making any actions on the instance itself, you can also use staticmethod decorator:

    @staticmethod
    def is_valid(x, y):
    

    This will get rid of the instance being passed in the arguments and you will only receive the remaining arguments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code works fine #define open { #define close } #include<stdio.h> #define int
i have used following code to repeat a process creation/close iteratively dim vProcessInfo as
In the following code: tcp::socket socket(io_service); tcp::endpoint ep(boost::asio::ip::address::from_string(addr), i); socket.async_connect(ep, &connect_handler); socket.close(); is it
I have a weird issue. I receive the following error that causes a force-close:
I am getting the following error when trying to attach an object that is
The following is my code for using Google Translate. I have one dll I
I'm using the following code to load an image from file into a bitmap
I have a file encrypted using the following code in c: unsigned char ckey[]
I am using the binary version of MaxMind's GEOIPCITY database. The following code gives
I am using following code to zip a file and it works fine but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.