Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1753)

Unified Diff: app.py

Issue 188683008: Make sure size calculations take jsonification into account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/chromium-build
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app.py
diff --git a/app.py b/app.py
index 9c2a4f1ee1ec824d28b4eac48d297d5cee287352..a00b12d1287f83fa0bfa31361ba574773be847a9 100644
--- a/app.py
+++ b/app.py
@@ -118,7 +118,6 @@ def get_and_cache_pagedata(localpath):
logging.debug('content for %s found in blobstore' % localpath)
blob_reader = blobstore.BlobReader(page.content_blob)
page_data['content_blob'] = True
- put_data_into_cache(localpath, page_data)
page_data['content'] = blob_reader.read().decode('utf-8', 'replace')
else:
logging.debug('content for %s found in datastore' % localpath)
@@ -140,7 +139,8 @@ def save_page(page, localpath, fetch_timestamp, page_data):
logging.debug('save_page: content was already in unicode')
logging.debug('save_page: content size is %d' % len(content))
# Save to blobstore if content + metadata is too big.
- if len(content.encode('utf-8')) >= 10**6 - 10**5:
+ json_data = json.dumps(content.encode('utf-8'), default=dtdumper)
+ if len(json_data) >= 10**6 - 10**5:
logging.debug('save_page: saving to blob')
content_blob_key = write_blob(content, path_to_mime_type(localpath))
content = None
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698