Blueprint registration form should default to you as drafter

Bug #125377 reported by Matthew Paul Thomas
2
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Douglas Cerna

Bug Description

If you are registering a blueprint, either you are the drafter, or it's your responsibility to find a drafter. Therefore, the registration form should have you as the default value for the "Drafter" field.

Related branches

Changed in blueprint:
status: New → Confirmed
Curtis Hovey (sinzui)
Changed in blueprint:
importance: Undecided → Low
status: Confirmed → Triaged
Revision history for this message
Vikram Dhillon (dhillon-v10) wrote :

Yes it makes sense here to return the default drafter as the person registering it. I'll work on it :) Thanks.

Changed in blueprint:
assignee: nobody → Vikram Dhillon (dhillon-v10)
Revision history for this message
Curtis Hovey (sinzui) wrote :

Hi Vikram.

The implementation for this is a bit tricky for new developers. This requires an update to one view and a new test.
 * lp.blueprints.browser.specification.NewSpecificationView
  The method may be as simple as this:
    def setUpWidgets(self):
        super(NewSpecificationView, self).setUpWidgets()
        widget = self.widgets['drafter']
        widget.setRenderedValue(self.user)

* lp.blueprints.browser.specification.test.test_specification.py
    drafter = self.factory.makePerson()
    view = create_initialized_view(target, '+new', principal=drafter)
    self.assertEqual(drafter, view.widgets['drafter']._getFormValue())

Revision history for this message
Vikram Dhillon (dhillon-v10) wrote :

Thanks Curtis, you rock, yes I have something like that in mind, I could just return the name in self.context.name as the default while registering the blueprint in the schema. The test for this could be little tricky, but I'll figure it out :)

Revision history for this message
Vikram Dhillon (dhillon-v10) wrote :

@Curtis: Just found this out:

class NewSpecificationView(LaunchpadFormView):
    """An abstract view for creating a new specification."""

    page_title = 'Register a blueprint in Launchpad'
    label = "Register a new blueprint"

    @action(_('Register Blueprint'), name='register')
    def register(self, action, data):
        """Registers a new specification."""
        self.transform(data)
        spec = getUtility(ISpecificationSet).new(
            owner = self.user,
            name = data.get('name'),
            title = data.get('title'),
            specurl = data.get('specurl'),
            summary = data.get('summary'),
            product = data.get('product'),
            drafter = data.get('drafter'), """<---- Could changing this to drafter = self.user make things work??"""
            assignee = data.get('assignee'),
            approver = data.get('approver'),
            distribution = data.get('distribution'),
            definition_status = data.get('definition_status'))

Revision history for this message
Curtis Hovey (sinzui) wrote :

This is the method processes the user's submitted data. That does not work because the user does not know he it being set the drafter. Users will quickly report bugs. The setUpWidgets(self) is the correct place to set default values so that the user can see and change the proposed value.

Curtis Hovey (sinzui)
Changed in launchpad:
assignee: Vikram Dhillon (dhillon-v10) → nobody
Changed in launchpad:
status: Triaged → In Progress
assignee: nobody → Douglas Cerna (replaceafill)
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
William Grant (wgrant)
tags: added: qa-ok
removed: qa-needstesting
William Grant (wgrant)
Changed in launchpad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.