AgentJay / webapp-improved

Automatically exported from code.google.com/p/webapp-improved
Other
0 stars 0 forks source link

webapp2_extras.session ndb backend doesn't work with ndb 0.9.6 used for deployed apps _now_ #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
ndb 0.9.6 is part of the upcoming appengine sdk 1.6.2.

More important: it's already running online!

More information:
http://code.google.com/p/appengine-ndb-experiment/issues/detail?id=146

The reported error from the online logs:

Expected str, got {'username': u'foo'}
Traceback (most recent call last):
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
    rv = self.handle_exception(request, response, e)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__
    rv = self.router.dispatch(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__
    return handler.dispatch()
  File "./utils/session.py", line 48, in dispatch
    self.session_store.save_sessions(self.response)
  File "./webapp2_extras/sessions.py", line 420, in save_sessions
    session.save_session(response)
  File "./webapp2_extras/appengine/sessions_ndb.py", line 118, in save_session
    self.session_model(id=self.sid, data=dict(self.session))._put()
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/utils.py", line 131, in positional_wrapper
    return wrapped(*args, **kwds)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 2248, in __init__
    self._set_attributes(kwds)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 2279, in _set_attributes
    prop._set_value(self, value)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 800, in _set_value
    value = self._do_validate(value)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 750, in _do_validate
    value = self._call_shallow_validation(value)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 928, in _call_shallow_validation
    return call(value)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 975, in call
    newvalue = method(self, value)
  File "/base/python27_runtime/python27_lib/versions/1/google/appengine/ext/ndb/model.py", line 1275, in _validate
    (value,))
BadValueError: Expected str, got {'username': u'foo'}

Original issue reported on code.google.com by joernhees2 on 27 Jan 2012 at 2:36

GoogleCodeExporter commented 8 years ago
Where is the source for the model class involved?

Original comment by guido@google.com on 27 Jan 2012 at 3:50

GoogleCodeExporter commented 8 years ago
Actually, I think I've found it. webapp2 has its own PickledProperty, which 
subclasses BlobProperty in a way that no longer works. It should just use the 
PickleProperty available in NDB.

Original comment by guido@google.com on 27 Jan 2012 at 3:52

GoogleCodeExporter commented 8 years ago
Another alternative is to downgrade both webapp2 and ndb: go back to 
webapp2-2.3 for your webapp2_extras and go back to ndb 0.9.3 (copy that into 
your appdir). That combination will continue to work. (I gather you have a copy 
of webapp2_extras in your app that comes from webapp2-2.4, because that's the 
first version of it that imports google.appengine.ext.ndb instead of toplevel 
ndb.

Original comment by guido@google.com on 27 Jan 2012 at 6:58

GoogleCodeExporter commented 8 years ago
This issue was closed by revision ffc709cbdd3b.

Original comment by guido@google.com on 27 Jan 2012 at 10:51

GoogleCodeExporter commented 8 years ago
awesome, thanks for the fixes (yupp, had an own clone of webapp2_extras fixing 
the from google.appengine.ext.ndb import issue)

Original comment by joernhees2 on 27 Jan 2012 at 11:27

GoogleCodeExporter commented 8 years ago
Only saw this now. Thanks for fixing it, Guido. I totally missed that the tests 
were still using the ndb from the lib dir.

Original comment by rodrigo.moraes on 29 Jan 2012 at 9:52

GoogleCodeExporter commented 8 years ago
Rodrigo, I think we'll need to release a version 2.5 to deal with this. Or 
could it be 2.4.1? What's your procedure for doing releases?

Original comment by guido@google.com on 30 Jan 2012 at 4:50

GoogleCodeExporter commented 8 years ago
Rodrigo, do you have time to answer some specific questions?

- Do you think we should do a new webapp2 external release to fix this bug?
- If so, should we release the new version as 2.4.1 or as 2.5?

Please review http://codereview.appspot.com/5580045/

Original comment by guido@google.com on 30 Jan 2012 at 7:21

GoogleCodeExporter commented 8 years ago
Version numbers are somewhat random. :)

I'll do a release this afternoon. Thanks.

Original comment by rodrigo.moraes on 31 Jan 2012 at 1:48

GoogleCodeExporter commented 8 years ago
I added PickeProperty so that tests pass with SDK 1.6.1: revision a70c62e4b79e

Let me know if it is ok.

Original comment by rodrigo.moraes on 31 Jan 2012 at 4:01

GoogleCodeExporter commented 8 years ago
Ok, looks fine. Let me know if you need anything, otherwise good luck
with the release and thanks again for webapp2!!

--Guido

Original comment by guido@google.com on 31 Jan 2012 at 6:08