Need to make the client_id even shorter. Switch to id()
This commit is contained in:
2
api.py
2
api.py
@@ -31,7 +31,7 @@ def CreateChannel(google_user, client, instance_id, args):
|
|||||||
instance = models.Instance.FindOrCreate(instance_id, client)
|
instance = models.Instance.FindOrCreate(instance_id, client)
|
||||||
|
|
||||||
token = channel.create_channel(
|
token = channel.create_channel(
|
||||||
client_id=str(instance),
|
client_id=str(instance.id()),
|
||||||
duration_minutes=config.CHANNEL_DURATION_SECONDS / 60)
|
duration_minutes=config.CHANNEL_DURATION_SECONDS / 60)
|
||||||
events = []
|
events = []
|
||||||
if google_user:
|
if google_user:
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ class OnChannelConnect(webapp2.RequestHandler):
|
|||||||
@utils.local_namespace
|
@utils.local_namespace
|
||||||
@db.transactional()
|
@db.transactional()
|
||||||
def post(self):
|
def post(self):
|
||||||
instance_key = self.request.get('from')
|
instance_id = self.request.get('from')
|
||||||
instance = models.Instance.get(instance_key)
|
instance = models.Instance.get_by_id(instance_id)
|
||||||
instance.active = True
|
instance.active = True
|
||||||
instance.put()
|
instance.put()
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ class OnChannelConnect(webapp2.RequestHandler):
|
|||||||
class OnChannelDisconnect(webapp2.RequestHandler):
|
class OnChannelDisconnect(webapp2.RequestHandler):
|
||||||
@utils.local_namespace
|
@utils.local_namespace
|
||||||
def post(self):
|
def post(self):
|
||||||
instance_key = self.request.get('from')
|
instance_id = self.request.get('from')
|
||||||
instance = models.Instance.get(instance_key)
|
instance = models.Instance.get_by_id(instance_id)
|
||||||
|
|
||||||
subscriptions = models.Subscription.all().filter('instance =', instance)
|
subscriptions = models.Subscription.all().filter('instance =', instance)
|
||||||
for subscription in subscriptions:
|
for subscription in subscriptions:
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ class Subscription(db.Model):
|
|||||||
def SendMessage(self, msg):
|
def SendMessage(self, msg):
|
||||||
instance_key = Subscription.instance.get_value_for_datastore(self)
|
instance_key = Subscription.instance.get_value_for_datastore(self)
|
||||||
channel.send_message(
|
channel.send_message(
|
||||||
str(instance_key),
|
str(instance_key.id()),
|
||||||
json.dumps(msg, default=utils.EncodeJSON))
|
json.dumps(msg, default=utils.EncodeJSON))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user