def acceptInviteGet(self, request, context, params, request_entity, **kwargs): """Handles the GET request concerning the creation of a Role via an invite. Args: request: the standard Django HTTP request object context: dictionary containing the context for this view params: a dict with params for this View request_entity: Request that is being accepted kwargs: contains the ID for the Request entity """ # create the form using the scope_path and link_id from kwargs # as initial value fields = { 'link_id': request_entity.user.link_id, 'scope_path': request_entity.group.key().id_or_name() } fields.update( role_logic.getSuggestedInitialProperties(request_entity.user)) form = params['invited_create_form'](initial=fields) # construct the appropriate response return super(View, self)._constructResponse(request, entity=None, context=context, form=form, params=params)
def acceptInviteGet(self, request, context, params, request_entity, **kwargs): """Handles the GET request concerning the creation of a Role via an invite. Args: request: the standard Django HTTP request object context: dictionary containing the context for this view params: a dict with params for this View request_entity: Request that is being accepted kwargs: contains the ID for the Request entity """ # create the form using the scope_path and link_id from kwargs # as initial value fields = {'link_id': request_entity.user.link_id, 'scope_path': request_entity.group.key().id_or_name()} fields.update(role_logic.getSuggestedInitialProperties( request_entity.user)) form = params['invited_create_form'](initial=fields) # construct the appropriate response return super(View, self)._constructResponse(request, entity=None, context=context, form=form, params=params)
def testGetSuggestedInitialProperties(self): """Test that correct properties are retrieved. """ role, properties = self.createRole(self.user) initial_properties = role_logic.getSuggestedInitialProperties(self.user) for key, value in properties.iteritems(): if key in initial_properties: self.assertEqual(value, initial_properties[key])
def testGetSuggestedInitialProperties(self): """Test that correct properties are retrieved. """ role, properties = self.createRole(self.user) initial_properties = role_logic.getSuggestedInitialProperties( self.user) for key, value in properties.iteritems(): if key in initial_properties: self.assertEqual(value, initial_properties[key])
def acceptInvitationGet(self, request, context, params, form, **kwargs): """Handles the GET request concerning the creation of a Role via an invitation. """ # create the form using the scope_path and link_id from request_entity # as initial value fields = { 'link_id': request_entity.user.link_id, 'scope_path': request_entity.group.key().id_or_name() } fields.update(role_logic.getSuggestedInitialProperties( request_entity.user)) form = form(initial=fields) # construct the appropriate response return super(View, self)._constructResponse(request, entity=None, context=context, form=form, params=params)
def acceptInvitationGet(self, request, context, params, form, **kwargs): """Handles the GET request concerning the creation of a Role via an invitation. """ # create the form using the scope_path and link_id from request_entity # as initial value fields = { 'link_id': request_entity.user.link_id, 'scope_path': request_entity.group.key().id_or_name() } fields.update( role_logic.getSuggestedInitialProperties(request_entity.user)) form = form(initial=fields) # construct the appropriate response return super(View, self)._constructResponse(request, entity=None, context=context, form=form, params=params)
def testGetSuggestedInitialPropertiesWithoutAnyRoles(self): """Test that an empty dict is returned when the user has no roles. """ properties = role_logic.getSuggestedInitialProperties(self.user) self.assertEqual(properties, {})