From cc34fb0b3dee1536f44912011b840906452e34fe Mon Sep 17 00:00:00 2001 From: Timothy Robinson Date: Sun, 10 Apr 2016 19:02:24 -0700 Subject: [PATCH 1/3] Add to_blob method for use with GAE --- tinify/result.py | 11 +++++++++++ tinify/source.py | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/tinify/result.py b/tinify/result.py index aa2d694..02c8481 100644 --- a/tinify/result.py +++ b/tinify/result.py @@ -2,12 +2,23 @@ from __future__ import absolute_import, division, print_function, unicode_literals from . import ResultMeta +<<<<<<< HEAD +from google.appengine.ext import ndb +======= +>>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 class Result(ResultMeta): def __init__(self, meta, data): ResultMeta.__init__(self, meta) self.data = data +<<<<<<< HEAD + def to_blob(self, key): + img_store = key.get() + img_store.img = self.data + +======= +>>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 def to_file(self, path): if hasattr(path, 'write'): path.write(self.data) diff --git a/tinify/source.py b/tinify/source.py index 36c4301..bef4496 100644 --- a/tinify/source.py +++ b/tinify/source.py @@ -3,6 +3,10 @@ import tinify from . import Result, ResultMeta +<<<<<<< HEAD +from google.appengine.ext import ndb +======= +>>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 class Source(object): @classmethod @@ -44,6 +48,13 @@ def result(self): response = tinify.get_client().request('GET', self.url, self.commands) return Result(response.headers, response.content) +<<<<<<< HEAD + # Google blob storage + def to_blob(self, key): + return self.result().to_blob(key) + +======= +>>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 def to_file(self, path): return self.result().to_file(path) From f10fa7e3088141deb507eccd8708254befd9aff1 Mon Sep 17 00:00:00 2001 From: Timothy Robinson Date: Sun, 10 Apr 2016 19:03:40 -0700 Subject: [PATCH 2/3] Update result.py --- tinify/result.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tinify/result.py b/tinify/result.py index 02c8481..68f8737 100644 --- a/tinify/result.py +++ b/tinify/result.py @@ -2,23 +2,17 @@ from __future__ import absolute_import, division, print_function, unicode_literals from . import ResultMeta -<<<<<<< HEAD from google.appengine.ext import ndb -======= ->>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 class Result(ResultMeta): def __init__(self, meta, data): ResultMeta.__init__(self, meta) self.data = data -<<<<<<< HEAD def to_blob(self, key): img_store = key.get() img_store.img = self.data -======= ->>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 def to_file(self, path): if hasattr(path, 'write'): path.write(self.data) From e5fef618446b5dfa247b189312ca575b3cd7b7ed Mon Sep 17 00:00:00 2001 From: Timothy Robinson Date: Sun, 10 Apr 2016 19:04:12 -0700 Subject: [PATCH 3/3] Update source.py --- tinify/source.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tinify/source.py b/tinify/source.py index bef4496..09d010e 100644 --- a/tinify/source.py +++ b/tinify/source.py @@ -3,10 +3,7 @@ import tinify from . import Result, ResultMeta -<<<<<<< HEAD from google.appengine.ext import ndb -======= ->>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 class Source(object): @classmethod @@ -48,13 +45,9 @@ def result(self): response = tinify.get_client().request('GET', self.url, self.commands) return Result(response.headers, response.content) -<<<<<<< HEAD - # Google blob storage def to_blob(self, key): return self.result().to_blob(key) -======= ->>>>>>> 2d19ee1f769aab78b981a335b7705819735047c4 def to_file(self, path): return self.result().to_file(path)