def recordDeviceIfRequired(self, device_model, manufacturer, telco=None): records = db.GqlQuery("SELECT * FROM MobileDevice WHERE device_id='%s'" % self.device_id) count = 0 for record in records: count += 1 record.os = self.os record.os_ver = self.os_ver record.app_ver = self.app_ver record.device_model = device_model record.manufacturer = manufacturer record.telco = telco record.put() if count==0: device = MobileDevice() device.device_id = self.device_id device.os = self.os device.os_ver = self.os_ver device.app_ver = self.app_ver device.device_model = device_model device.manufacturer = manufacturer device.telco = telco device.put() self.incrementDailyNewUser()