Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use protocol 2 when pickling #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.runtime.apiproxy_errors import RequestTooLargeError
from google.appengine.runtime.apiproxy_errors import RequestTooLargeError

sys.path.insert(0, os.path.join(os.getcwd(), 'sympy'))

from sympy import srepr, sstr, pretty, latex

import detectmobile

PRINTERS = {
Expand Down Expand Up @@ -471,7 +471,10 @@ def set_global(self, name, value):
"""
# We need to disable the pickling optimization here in order to get the
# correct values out.
blob = db.Blob(self.fast_dumps(value, 1))

# We use protocol 2 here. This is necessary to make things like pickling
# of singletons work correctly
blob = db.Blob(self.fast_dumps(value, -1))

if name in self.global_names:
index = self.global_names.index(name)
Expand Down Expand Up @@ -566,8 +569,8 @@ class FrontPageHandler(webapp.RequestHandler):
"""Creates a new session and renders the ``shell.html`` template. """

def get(self):


#Get the 10 most recent queries
searches_query = Searches.all().filter('private', False).order('-timestamp')
search_results = searches_query.fetch(10)
Expand All @@ -583,9 +586,9 @@ def get(self):
forcedesktop = 'no'

if forcedesktop == 'no':
if detectmobile.isMobile(self.request.headers):
if detectmobile.isMobile(self.request.headers):
self.redirect('/shellmobile')

template_file = os.path.join(os.path.dirname(__file__), 'templates', 'shell.html')

vars = {
Expand Down