ajgomezlopez
unread,Apr 17, 2011, 3:34:11 PM4/17/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to appengine-utilities
Hello, Im using gaeutils sessions for an aplication in appengine. I
use my own model as this way:
*****
from gaeutils import sessions
from google.appengine.ext.webapp import RequestHandler
class RequestHandlerExt(RequestHandler):
def __init__(self):
RequestHandler.__init__(self)
self.SESSION = sessions.Session()
if not 'times' in self.SESSION:
self.SESSION['times'] = 0
if not 'login' in self.SESSION:
self.SESSION['login'] = ''
if not 'email' in self.SESSION:
self.SESSION['email'] = ''
if not 'lang' in self.SESSION:
self.SESSION['lang'] = 'es'
if not 'activecustomer' in self.SESSION:
self.SESSION['activecustomer'] = ''
******
So i can chek my session vars in all of my RequestHandlerExt
instances.
But wen pass some time, if i go to login in my application throw an
Internal server error .
I have this information from the log.
******
<class 'google.appengine.api.datastore_errors.BadKeyError'>: Invalid
string key
ahNhamdvbWV6bG9wZXotc2FtcGxlciMLEhtfQXBwRW5naW5lVXRpbGl0aWVzX1Nlc3Npb24Y.
Traceback (most recent call last):
File "/base/data/home/apps/ajgomezlopez-sample/2.349694386919970151/
main.py", line 147, in main
util.run_wsgi_app(application)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/__init__.py", line 619, in __call__
handler = handler_class()
File "/base/data/home/apps/ajgomezlopez-sample/2.349694386919970151/
webappext.py", line 10, in __init__
self.SESSION = sessions.Session()
File "/base/data/home/apps/ajgomezlopez-sample/2.349694386919970151/
gaeutils/sessions.py", line 562, in __init__
self.session = _AppEngineUtilities_Session.get_session(self)
File "/base/data/home/apps/ajgomezlopez-sample/2.349694386919970151/
gaeutils/sessions.py", line 142, in get_session
ds_session = db.get(str(session_key))
File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/db/__init__.py", line 1422, in get
keys, multiple = datastore.NormalizeAndTypeCheckKeys(keys)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
api/datastore.py", line 180, in NormalizeAndTypeCheckKeys
keys = [_GetCompleteKeyOrError(key) for key in keys]
File "/base/python_runtime/python_lib/versions/1/google/appengine/
api/datastore.py", line 2339, in _GetCompleteKeyOrError
key = Key(arg)
File "/base/python_runtime/python_lib/versions/1/google/appengine/
api/datastore_types.py", line 364, in __init__
raise datastore_errors.BadKeyError('Invalid string key %s.' %
encoded)
******
1º.- ¿Any one knows why is happend this?
2º.- ¿Is there any way to add a variable to a session without
declarate first?
Thanks for all in advance and sorry for my english.