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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:27:44+00:00 2026-06-05T00:27:44+00:00

I’m getting an AssertError when trying to instantiate my User model. In the stack

  • 0

I’m getting an AssertError when trying to instantiate my User model. In the stack trace below, I left out the dispatching of the request to the request handler.

File "/Users/frederikcreemers/jsbeast/users.py", line 68, in get
    User(nickname=nickname,user=users.get_current_user()).put()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 2926, in _put
    return self._put_async(**ctx_options).get_result()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/tasklets.py", line 322, in get_result
    self.check_success()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/tasklets.py", line 317, in check_success
    self.wait()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/tasklets.py", line 301, in wait
    if not ev.run1():
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/eventloop.py", line 219, in run1
    delay = self.run0()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/eventloop.py", line 181, in run0
    callback(*args, **kwds)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/context.py", line 170, in _finished_callback
    fut.check_success()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/tasklets.py", line 362, in _help_tasklet_along
    value = gen.send(val)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/context.py", line 268, in _put_tasklet
    keys = yield self._conn.async_put(options, datastore_entities)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1550, in async_put
    pbs = [self.__adapter.entity_to_pb(entity) for entity in entities]
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 548, in entity_to_pb
    pb = ent._to_pb()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 2719, in _to_pb
    prop._serialize(self, pb)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 1245, in _serialize
    values = self._get_base_value_unwrapped_as_list(entity)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 1034, in _get_base_value_unwrapped_as_list
    wrapped = self._get_base_value(entity)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 1022, in _get_base_value
    return self._apply_to_values(entity, self._opt_call_to_base_type)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 1186, in _apply_to_values
    newvalue = function(value)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 1065, in _opt_call_to_base_type
    value = _BaseValue(self._call_to_base_type(value))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/ndb/model.py", line 599, in __init__
    assert not isinstance(b_val, list), repr(b_val)
AssertionError: []

The code where this happens looks like this:

class LoginHandler(webapp2.RequestHandler):
    def get(self):
        url = self.request.get('url')

        if not url:
            url = "/"
        if User.current():
            self.redirect(url)
        else:
            if users.get_current_user():
                nickname = self.request.get("nickname")
                if(not nickname):
                    self.response.out.write(views.render("nickname"))
                    return
                else:
                    errors = []
                    if len(nickname) < 3:
                        errors.append("Your nickname should be at least 3 characters long.")

                    if(len(nickname) > 15):
                        errors.append("Your nickname should not be longer than 15 characters.")

                    import re
                    if not re.match(r"[0-9a-zA-Z_\.]+$",nickname):
                        errors.append("Your nickname can only contain small and capital letters, numbers, underscores and dots.")

                    if len(errors) == 0 and User.by_nickname(nickname):
                        errors.append("The name "+nickname+" is already in use.")


                    if len(errors) == 0:
                        import logging
                        User(nickname=nickname,user=users.get_current_user()).put()
                        self.redirect(url)
                    else:
                        self.response.out.write(views.render('nickname',{'errors':errors}))
                        return
            else:
                self.redirect(users.create_login_url("/user/login",federated_identity=self.request.get('provider')))

Note that although I import google.appengine.api.users the User objecvt from that module is kept in the users namespace, so the conflict can’t be there.

this is what the User model looks like:

class User(ndb.Model):
nickname = ndb.StringProperty()
email = ndb.StringProperty()
user = ndb.UserProperty()
num_solved_problems = ndb.ComputedProperty(lambda self: problems.Attempt.query().filter(problems.Attempt.user == self.user,problems.Attempt.correct == True).count())
solved_problems = ndb.ComputedProperty(lambda self:problems.Attempt.query().filter(problems.Attempt.user == self.user,problems.Attempt.correct == True).fetch())

@classmethod
def current(cls):
    if not users.get_current_user():
        return None
    return cls.query().filter(User.user == users.get_current_user()).get()

@classmethod
def by_nickname(cls,nickname):
        return cls.query().filter(User.nickname == nickname).get()
  • 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-05T00:27:46+00:00Added an answer on June 5, 2026 at 12:27 am

    My guess is that the ComputedProperty solved_problems needs to say repeated=True because fetch() returns a list.

    PS. Not your fault, but it’s hard to read code samples when SO insists on displaying horizontal scroll bars.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

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.