def generate_launch_data(self, user=None, context_id=None, **additional_launch_data): params = dict( tool_consumer_instance_guid=get_tool_consumer_instance_guid(), custom_badgr_api_url=OriginSetting.HTTP, custom_launchpoint=self.launchpoint) params.update(additional_launch_data) if user is not None: params.update( dict(custom_badgr_user_id=user.entity_id, lis_person_name_family=urllib.quote_plus( user.last_name.encode('utf-8')), lis_person_name_given=urllib.quote_plus( user.first_name.encode('utf-8')), lis_person_contact_email_primary=urllib.quote_plus( user.primary_email.encode('utf-8')))) if context_id is not None: params['custom_context_id'] = context_id context_obj = self.lookup_obj_by_launchpoint( params, user, context_id) tool_consumer = self.get_tool_consumer(extra_params=params) launch_data = tool_consumer.generate_launch_data() return launch_data
def generate_launch_data(self, user=None, context_id=None, **additional_launch_data): params = dict( tool_consumer_instance_guid=get_tool_consumer_instance_guid(), custom_badgr_api_url=OriginSetting.HTTP, custom_launchpoint=self.launchpoint ) params.update(additional_launch_data) if user is not None: params.update(dict( custom_badgr_user_id=user.entity_id, lis_person_name_family=urllib.quote_plus(user.last_name.encode('utf-8')), lis_person_name_given=urllib.quote_plus(user.first_name.encode('utf-8')), lis_person_contact_email_primary=urllib.quote_plus(user.primary_email.encode('utf-8')) )) if context_id is not None: params['custom_context_id'] = context_id context_obj = self.lookup_obj_by_launchpoint(params, user, context_id) tool_consumer = self.get_tool_consumer(extra_params=params) launch_data = tool_consumer.generate_launch_data() return launch_data