def notify_all_source_delete(self, source, originating_device_id): devices = UserDevices.get_user_devices(source.owner) for device in devices: # Skip the device if that was the device that originated the request. if device.key().id() == originating_device_id: continue self.notify_source_delete(source, device)
def notify_all_source_delete(self, source, originating_device_id): devices = UserDevices.get_user_devices(source.owner) for device in devices: # Skip the device if that was the device that originated the request. if device.key().id() == originating_device_id: continue self.notify_source_delete(source, device)
def send_to_all(self, message): devices = UserDevices.get_user_devices(message.owner) for device in devices: self.send(message, device) message.deliveredToGoogle = True message.lastDeliveryAttempt = datetime.datetime.now() message.put()
def send_to_all(self, message): devices = UserDevices.get_user_devices(message.owner) for device in devices: self.send(message, device) message.deliveredToGoogle = True message.lastDeliveryAttempt = datetime.datetime.now() message.put()
def GET(self): # Must be logged in. login_required() # List all their sources. sources = UserSources.get_user_sources(users.get_current_user()) sources = sorted(sources, key=lambda source: source.title) renderer.addDataList('sources', sources) # List all their devices. devices = UserDevices.get_user_devices(users.get_current_user()) devices = sorted(devices, key=lambda device: device.updated) renderer.addDataList('devices', devices) return renderer.render('profile/index.html')
def GET(self): # Must be logged in. login_required() # List all their sources. sources = UserSources.get_user_sources(users.get_current_user()) sources = sorted(sources, key=lambda source: source.title) renderer.addDataList('sources', sources) # List all their devices. devices = UserDevices.get_user_devices(users.get_current_user()) devices = sorted(devices, key=lambda device: device.updated) renderer.addDataList('devices', devices) return renderer.render('profile/index.html')
def GET(self): # Must be logged in. login_required() mailbody = "Newtifry user data : \n" mailbody += "User : "******"\n" mailbody += "Message count : " + str(get_message_count(users.get_current_user())) + "\n" mailbody += "Sources : \n" # List all their sources. sources = UserSources.get_user_sources(users.get_current_user()) sources = sorted(sources, key=lambda source: source.title) for source in sources: mailbody += source.title + " " if source.enabled: mailbody += "Enabled " else: mailbody += "Disabled " mailbody += source.externalKey + "\n" mailbody += "\nDevices : \n" devices = UserDevices.get_user_devices(users.get_current_user()) devices = sorted(devices, key=lambda device: device.updated) for device in devices: mailbody += device.deviceNickname + "\n\tHash : " + device.hash() + "\n\tDevicekey " + device.deviceKey + "\n\tDevice Version " + device.deviceVersion + "\n" mailbody += "\n\nRegards\n" # renderer.addDataList('sources', sources) # renderer.addData('messagecount', get_message_count(users.get_current_user())); # renderer.addData('messageleft', get_quota(users.get_current_user())); # List all their devices. # renderer.addDataList('devices', devices) mail.send_mail(sender="Newtifry <*****@*****.**>", to="Newtifry user " + users.get_current_user().email(), subject="Newtifry user data", body=mailbody) renderer.addData('owner_mail', users.get_current_user().email()) return renderer.render('profile/datasent.html')