From 8dae3f832d113bee5cf23980d01119f8234cb694 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 29 Oct 2012 22:22:36 -0500 Subject: [PATCH] gluon/contrib/login_methods/dropbox_account.py, get client --- VERSION | 2 +- gluon/contrib/login_methods/dropbox_account.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 557596d6..32811d39 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.2.1 (2012-10-29 21:38:03) stable +Version 2.2.1 (2012-10-29 22:22:31) stable diff --git a/gluon/contrib/login_methods/dropbox_account.py b/gluon/contrib/login_methods/dropbox_account.py index 8bfc7079..597320ee 100644 --- a/gluon/contrib/login_methods/dropbox_account.py +++ b/gluon/contrib/login_methods/dropbox_account.py @@ -99,13 +99,21 @@ class DropboxAccount(object): redirect('https://www.dropbox.com/logout') return next + def get_client(self): + access_token = current.session.dropbox_access_token + self.sess.set_token(access_token[0], access_token[1]) + self.client = client.DropboxClient(self.sess) + def put(self, filename, file): + if not hasattr(self,'client'): self.get_client() return json.loads(self.client.put_file(filename, file))['bytes'] def get(self, filename, file): + if not hasattr(self,'client'): self.get_client() return self.client.get_file(filename) def dir(self, path): + if not hasattr(self,'client'): self.get_client() return json.loads(self.client.metadata(path))