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 870499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:29:13+00:00 2026-05-15T10:29:13+00:00

I am working on a Flask extension that adds CouchDB support to Flask. To

  • 0

I am working on a Flask extension that adds CouchDB support to Flask. To make it easier, I have subclassed couchdb.mapping.Document so the store and load methods can use the current thread-local database. Right now, my code looks like this:

class Document(mapping.Document):
  # rest of the methods omitted for brevity
  @classmethod
  def load(cls, id, db=None):
    return mapping.Document.load(cls, db or g.couch, id)

I left out some for brevity, but that’s the important part. However, due to the way classmethod works, when I try to call this method, I receive the error message

  File "flaskext/couchdb.py", line 187, in load
    return mapping.Document.load(cls, db or g.couch, id)
TypeError: load() takes exactly 3 arguments (4 given)

I tested replacing the call with mapping.Document.load.im_func(cls, db or g.couch, id), and it works, but I’m not particularly happy about accessing the internal im_ attributes (even though they are documented). Does anyone have a more elegant way to handle this?

  • 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-05-15T10:29:14+00:00Added an answer on May 15, 2026 at 10:29 am

    I think you actually need to use super here. That’s the neater way to call superclass methods anyway:

    class A(object):
        @classmethod
        def load(cls):
            return cls
    
    class B(A):
        @classmethod
        def load(cls):
            # return A.load() would simply do "A.load()" and thus return a A
            return super(B, cls).load() # super figures out how to do it right ;-)
    
    
    print B.load()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a flask app that needs authentication. I've hooked up flask-login but
I have a working webapp based on Python, Flask. (configured to work on http://
I am working with Flask 0.9. I have experience with Google App Engine. In
Hai am trying to load the variables from parent(flash) to child(flash).Its working fine,. parent
I have a Flash developer I'm working with. This person is building a tool
I'm trying to get file uploads with flask-uploads working and running in to some
I'm currently working on a project using Flask and Google App Engine . Calling
I'm working on Flash Builder with latest flex SDK. I have a problem getting
i'm working with Flash Live Encoder. It's using camera for streaming video. Support forum
I'm looking into using XText to make an extenstion DSL to a language that

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.