From 1ec2340f48f2a703f572ab080d8fb5048c727fa4 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Fri, 23 May 2014 11:40:08 -0700 Subject: [PATCH] Need to make the client_id even shorter. Switch to id() --- api.py | 2 +- channel.py | 8 ++++---- lib/models.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api.py b/api.py index 1ab8815..13c4023 100644 --- a/api.py +++ b/api.py @@ -31,7 +31,7 @@ def CreateChannel(google_user, client, instance_id, args): instance = models.Instance.FindOrCreate(instance_id, client) token = channel.create_channel( - client_id=str(instance), + client_id=str(instance.id()), duration_minutes=config.CHANNEL_DURATION_SECONDS / 60) events = [] if google_user: diff --git a/channel.py b/channel.py index 8ffdcd2..7385e01 100644 --- a/channel.py +++ b/channel.py @@ -25,8 +25,8 @@ class OnChannelConnect(webapp2.RequestHandler): @utils.local_namespace @db.transactional() def post(self): - instance_key = self.request.get('from') - instance = models.Instance.get(instance_key) + instance_id = self.request.get('from') + instance = models.Instance.get_by_id(instance_id) instance.active = True instance.put() @@ -34,8 +34,8 @@ class OnChannelConnect(webapp2.RequestHandler): class OnChannelDisconnect(webapp2.RequestHandler): @utils.local_namespace def post(self): - instance_key = self.request.get('from') - instance = models.Instance.get(instance_key) + instance_id = self.request.get('from') + instance = models.Instance.get_by_id(instance_id) subscriptions = models.Subscription.all().filter('instance =', instance) for subscription in subscriptions: diff --git a/lib/models.py b/lib/models.py index 2c26291..e02c959 100644 --- a/lib/models.py +++ b/lib/models.py @@ -283,7 +283,7 @@ class Subscription(db.Model): def SendMessage(self, msg): instance_key = Subscription.instance.get_value_for_datastore(self) channel.send_message( - str(instance_key), + str(instance_key.id()), json.dumps(msg, default=utils.EncodeJSON))