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

  • Home
  • SEARCH
  • 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 9224827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:25:25+00:00 2026-06-18T04:25:25+00:00

Within the GAE I’m getting an error telling me: TypeError: get_default_tile() takes exactly 1

  • 0

Within the GAE I’m getting an error telling me:

TypeError: get_default_tile() takes exactly 1 argument (2 given)

As you can see the code from my main py file get_default_tile() is being passed only one argument which is name:

 default_tile = self.get_default_tile(name)

The full code follows:

import jinja2   # html template libary
import os

jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)))

import urllib   
import urllib2 
import webapp2

from google.appengine.ext import db
from google.appengine.api import urlfetch


class Default_tiles(db.Model):
  name = db.StringProperty()
  image = db.BlobProperty(default=None)


class MainPage(webapp2.RequestHandler):
  def get(self):

    # this just prints out the url which the user enters into input
    image_name = self.request.get('image_name') 

    template_values = {
        'image_name': image_name,
    }

    template = jinja_environment.get_template('index.html')
    self.response.out.write(template.render(template_values))



class Upload(webapp2.RequestHandler):
  def post(self):

    # get information from form post upload
    image_url = self.request.get('image_url') 
    image_name = self.request.get('image_name')

    # create database entry for uploaded image 
    default_tile = Default_tiles()
    default_tile.name = image_name
    default_tile.image = db.Blob(urlfetch.Fetch(image_url).content)
    default_tile.put()

    self.redirect('/?' + urllib.urlencode({'image_name': image_name}))


class Get_default_tile(webapp2.RequestHandler):
  def get(self):
    name = self.request.get('image_name')
    default_tile = self.get_default_tile(name)

    self.response.headers['Content-Type'] = "image/png"
    self.response.out.write(default_tile.image)

  def get_default_tile(name):
    result = db.GqlQuery("SELECT * FROM Default_tiles WHERE name = :1 LIMIT 1", name).fetch(1)
    if (len(result) > 0):
      return result[0]
    else:
      return None


app = webapp2.WSGIApplication([('/', MainPage),
                               ('/upload', Upload),
                               ('/default_tile_img', Get_default_tile)],
                              debug=True)

Any help would be appreciated.

  • 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-18T04:25:26+00:00Added an answer on June 18, 2026 at 4:25 am

    get_default_tile(): is a member method of class Get_default_tile so you need to define it like this:

    def get_default_tile(self, name):

    Or if you want it to be a static method:

    @staticmethod
    def get_default_tile(name):
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Within an ajax request how can the error callback be tested ? Is it
I have produced a new Maven Project from gae-archetype-gwt from within IntelliJ, and everything
Within my ajax call if an error is received I have an alert :
Within a for loop, I'm using the following code to convert from one date
Within Google Spreadsheets, how can I retrieve the max and min values of a
Within my code I have list items like this; <div id=content> <ul class=kwicks> <li
I've got some problems to use gorilla mux within GAE. When I try it,
GAE comes with an inbuilt jetty webserver for testing purpose.Can it be configured to
Is there a way to avoid GAE server restart when the file within the
I want to test a server I have deployed on GAE to see if

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.