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

Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a
I'm working on an ASP.NET MVC app that uses a Flash movie as a
Recently I've been working on some embedded devices, where we have some structs and
I have used Flex for about a year before deciding that I would rather
I am working on a Flash Project in which i have to rotate a
I'm currently working on a Flash application that needs to save files to Drupal.
I'm currently working on a flash project that has an intro video that plays
All, I'm working on a Flash AS2 project in which I have a choice

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.