Make Instance actually stand alone.
This commit is contained in:
14
channel.py
14
channel.py
@@ -33,17 +33,23 @@ class OnChannelConnect(webapp2.RequestHandler):
|
||||
|
||||
|
||||
class OnChannelDisconnect(webapp2.RequestHandler):
|
||||
@staticmethod
|
||||
@db.transactional()
|
||||
def DeleteInstance(instance_id):
|
||||
instance = models.Instance.FromID(instance_id)
|
||||
ret = instance.key()
|
||||
instance.delete()
|
||||
return ret
|
||||
|
||||
@utils.local_namespace
|
||||
def post(self):
|
||||
instance_id = self.request.get('from')
|
||||
instance = models.Instance.FromID(instance_id)
|
||||
instance_key = self.DeleteInstance(instance_id)
|
||||
|
||||
subscriptions = models.Subscription.all().filter('instance =', instance)
|
||||
subscriptions = models.Subscription.all().filter('instance =', instance_key)
|
||||
for subscription in subscriptions:
|
||||
subscription.delete()
|
||||
|
||||
instance.delete()
|
||||
|
||||
|
||||
app = webapp2.WSGIApplication([
|
||||
('/_ah/channel/connected/', OnChannelConnect),
|
||||
|
||||
Reference in New Issue
Block a user