http://codereview.appspot.com/6349087/diff/1/oauth2client/clientsecrets.py File oauth2client/clientsecrets.py (right): http://codereview.appspot.com/6349087/diff/1/oauth2client/clientsecrets.py#newcode122 oauth2client/clientsecrets.py:122: from google.appengine.api import memcache On 2012/07/11 16:21:42, jcgregorio_google wrote: ...
12 years, 12 months ago
(2012-07-11 18:59:35 UTC)
#2
http://codereview.appspot.com/6349087/diff/1/oauth2client/clientsecrets.py
File oauth2client/clientsecrets.py (right):
http://codereview.appspot.com/6349087/diff/1/oauth2client/clientsecrets.py#ne...
oauth2client/clientsecrets.py:122: from google.appengine.api import memcache
On 2012/07/11 16:21:42, jcgregorio_google wrote:
> Anything that depends on App Engine explicitly should go in
> oauth2client.appengine, but I don't think moving it there is a good idea.
> Instead, pass in a memcache instance via the parameters, that will also make
> testing easier as the tests don't need to rely on App Engine, you can just
> create a simple mock of the memcache interface.
Good point!
Done. At least, this is how I imagine it.
Actually, NDB doesn't pick up RPCs that were not originally registered with its autobatcher. Plus, ...
12 years, 12 months ago
(2012-07-12 10:52:25 UTC)
#3
Actually, NDB doesn't pick up RPCs that were not originally registered with its
autobatcher. Plus, in this specific case I don't think async is really worth it.
So, here's a simplified version, w/o async.
http://codereview.appspot.com/6349087/diff/2002/oauth2client/clientsecrets.py File oauth2client/clientsecrets.py (right): http://codereview.appspot.com/6349087/diff/2002/oauth2client/clientsecrets.py#newcode122 oauth2client/clientsecrets.py:122: cache: a cache service client that implements get() and ...
12 years, 12 months ago
(2012-07-12 12:55:01 UTC)
#4
http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.py File oauth2client/clientsecrets.py (right): http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.py#newcode108 oauth2client/clientsecrets.py:108: def load_cached(filename, cache): Sounds good to me, rename this ...
12 years, 11 months ago
(2012-07-13 13:39:40 UTC)
#8
http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.py
File oauth2client/clientsecrets.py (right):
http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.p...
oauth2client/clientsecrets.py:108: def load_cached(filename, cache):
Sounds good to me, rename this function to loadfile, rename the original
loadfile to _loadfile. You can also add the optional 'cache' arguments to all
the *FromClientSecrets classes and methods if you feel motivated :)
On 2012/07/12 18:37:10, crhyme wrote:
> Hey, I was thinking to change the signature to
>
> def load_cached(filename, cache=None)
>
> Where cache=None just falls back to loadfile(filename). This seems to follow
> other libs (e.g. httplib2) closer. Plus, that way other pieces of oauth2client
> could be alternated (where needed for e.g. App Engine) and be totally
backwards
> compatible, for instance:
>
> flow_from_clientsecrets(filename, scope, message=None, cache=None)
>
> or, OAuth2DecoratorFromClientSecrets:
> def __init__(self, filename, scope, message=None, cache=None):
>
> or, would it be better for the above __init__() code to just load_cached()
> instead of (currenty) loadfile().
>
> What do you think?
The optional 'cache' param change for *FromClientSecrets is trivial but I can add some test ...
12 years, 11 months ago
(2012-07-13 14:50:51 UTC)
#9
The optional 'cache' param change for *FromClientSecrets is trivial but I can
add some test cases for client.py and appengine.py if needed.
http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.py
File oauth2client/clientsecrets.py (right):
http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.p...
oauth2client/clientsecrets.py:108: def load_cached(filename, cache):
On 2012/07/13 13:39:40, jcgregorio_google wrote:
> Sounds good to me, rename this function to loadfile, rename the original
> loadfile to _loadfile. You can also add the optional 'cache' arguments to all
> the *FromClientSecrets classes and methods if you feel motivated :)
>
> On 2012/07/12 18:37:10, crhyme wrote:
> > Hey, I was thinking to change the signature to
> >
> > def load_cached(filename, cache=None)
> >
> > Where cache=None just falls back to loadfile(filename). This seems to follow
> > other libs (e.g. httplib2) closer. Plus, that way other pieces of
oauth2client
> > could be alternated (where needed for e.g. App Engine) and be totally
> backwards
> > compatible, for instance:
> >
> > flow_from_clientsecrets(filename, scope, message=None, cache=None)
> >
> > or, OAuth2DecoratorFromClientSecrets:
> > def __init__(self, filename, scope, message=None, cache=None):
> >
> > or, would it be better for the above __init__() code to just load_cached()
> > instead of (currenty) loadfile().
> >
> > What do you think?
>
Done.
On 2012/07/13 14:50:51, crhyme wrote: > The optional 'cache' param change for *FromClientSecrets is trivial ...
12 years, 11 months ago
(2012-07-13 15:24:35 UTC)
#10
On 2012/07/13 14:50:51, crhyme wrote:
> The optional 'cache' param change for *FromClientSecrets is trivial but I can
> add some test cases for client.py and appengine.py if needed.
Yes, please do.
>
> http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.py
> File oauth2client/clientsecrets.py (right):
>
>
http://codereview.appspot.com/6349087/diff/10001/oauth2client/clientsecrets.p...
> oauth2client/clientsecrets.py:108: def load_cached(filename, cache):
> On 2012/07/13 13:39:40, jcgregorio_google wrote:
> > Sounds good to me, rename this function to loadfile, rename the original
> > loadfile to _loadfile. You can also add the optional 'cache' arguments to
all
> > the *FromClientSecrets classes and methods if you feel motivated :)
> >
> > On 2012/07/12 18:37:10, crhyme wrote:
> > > Hey, I was thinking to change the signature to
> > >
> > > def load_cached(filename, cache=None)
> > >
> > > Where cache=None just falls back to loadfile(filename). This seems to
follow
> > > other libs (e.g. httplib2) closer. Plus, that way other pieces of
> oauth2client
> > > could be alternated (where needed for e.g. App Engine) and be totally
> > backwards
> > > compatible, for instance:
> > >
> > > flow_from_clientsecrets(filename, scope, message=None, cache=None)
> > >
> > > or, OAuth2DecoratorFromClientSecrets:
> > > def __init__(self, filename, scope, message=None, cache=None):
> > >
> > > or, would it be better for the above __init__() code to just load_cached()
> > > instead of (currenty) loadfile().
> > >
> > > What do you think?
> >
>
> Done.
http://codereview.appspot.com/6349087/diff/17001/tests/test_oauth2client_clientsecrets.py File tests/test_oauth2client_clientsecrets.py (right): http://codereview.appspot.com/6349087/diff/17001/tests/test_oauth2client_clientsecrets.py#newcode127 tests/test_oauth2client_clientsecrets.py:127: self.assertIsNone(self.cache_mock.last_set_ns) assertIsNone only works on Python 2.7, please use ...
12 years, 11 months ago
(2012-07-16 16:17:15 UTC)
#15
Issue 6349087: Loading of client_secrets JSON file backed by a cache
Created 12 years, 12 months ago by alexv
Modified 12 years, 11 months ago
Reviewers: jcgregorio_google
Base URL:
Comments: 23