def get(self): counselor = Counselor.get_by_key_name(str(self.request.get("key"))) if counselor.avatar: self.response.headers["Content-Type"] = "image/jpg" self.response.out.write(counselor.avatar) else: self.response.headers["Content-Type"] = "image/jpg" self.response.out.write(urlfetch.Fetch("https://second-friend.appspot.com/static/img/avatar.jpg").content)
def get(self): # update user status to 0 counselor = Counselor.get_by_key_name(str(users.get_current_user().user_id())) # set status to 0, unavailable if counselor: counselor.status = 0 counselor.put() self.redirect(users.create_logout_url('/'))
def get(self): # update user status to 0 counselor = Counselor.get_by_key_name( str(users.get_current_user().user_id())) # set status to 0, unavailable if counselor: counselor.status = 0 counselor.put() self.redirect(users.create_logout_url('/'))
def get(self): counselor = Counselor.get_by_key_name(str(self.request.get('key'))) if counselor.avatar: self.response.headers['Content-Type'] = "image/jpg" self.response.out.write(counselor.avatar) else: self.response.headers['Content-Type'] = "image/jpg" self.response.out.write( urlfetch.Fetch( 'https://second-friend.appspot.com/static/img/avatar.jpg'). content)
def get(self): uuid = self.request.get('channel') #self.request.get('uuid') channel = self.request.get('channel') purge = self.request.get('purge') # Counselor.key().name() counselor = False if purge: counselor = Counselor.get_by_key_name(purge) else: counselors = Counselor.all() #counselors.filter('status >', 0) #counselors.filter('channels IN', [channel]) counselors = counselors.fetch(10) for c in counselors: if channel in c.channels: counselor = c break if counselor: if not purge and channel in counselor.channels: counselor.channels.remove(channel) if purge: counselor.channels = [] counselor.put() # publish the command info = pubnub.publish({ 'channel': 'counselor-' + counselor.key().name(), 'message': { 'action': 'purge' if purge else 'remove', 'uuid': uuid, 'channel': channel } }) self.response.headers['Access-Control-Allow-Origin'] = '*' self.response.set_status(200) self.response.out.write('removed')
def get(self): uuid = self.request.get('channel') #self.request.get('uuid') channel = self.request.get('channel') purge = self.request.get('purge') # Counselor.key().name() counselor = False if purge: counselor = Counselor.get_by_key_name(purge) else: counselors = Counselor.all() #counselors.filter('status >', 0) #counselors.filter('channels IN', [channel]) counselors = counselors.fetch(10) for c in counselors: if channel in c.channels: counselor = c break if counselor: if not purge and channel in counselor.channels: counselor.channels.remove(channel) if purge: counselor.channels = [] counselor.put() # publish the command info = pubnub.publish({ 'channel' : 'counselor-'+ counselor.key().name(), 'message' : { 'action': 'purge' if purge else 'remove', 'uuid': uuid, 'channel' : channel } }) self.response.headers['Access-Control-Allow-Origin'] = '*' self.response.set_status(200) self.response.out.write('removed')