launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26639
Re: [Merge] ~pappacena/launchpad:snap-pillar-edit into launchpad:master
Pushed the requested changes.
Diff comments:
> diff --git a/lib/lp/snappy/browser/snap.py b/lib/lp/snappy/browser/snap.py
> index bd3926c..d4ba8bd 100644
> --- a/lib/lp/snappy/browser/snap.py
> +++ b/lib/lp/snappy/browser/snap.py
> @@ -597,27 +637,19 @@ class SnapAddView(
> 'name',
> 'There is already a snap package owned by %s with this '
> 'name.' % owner.displayname)
> + self.validateInformationType(data)
>
>
> -class BaseSnapEditView(LaunchpadEditFormView, SnapAuthorizeMixin):
> +class BaseSnapEditView(LaunchpadEditFormView, SnapAuthorizeMixin,
> + SnapInformationTypeMixin):
>
> schema = ISnapEditSchema
>
> - def getInformationTypesToShow(self):
> - """Get the information types to display on the edit form.
> -
> - We display a customised set of information types: anything allowed
> - by the repository's model, plus the current type.
> - """
> - allowed_types = set(self.context.getAllowedInformationTypes(self.user))
> - allowed_types.add(self.context.information_type)
> - return allowed_types
> -
> @property
> def cancel_url(self):
> return canonical_url(self.context)
>
> - def setUpWidgets(self):
> + def setUpWidgets(self, context=None):
Yep. Adding it now.
> """See `LaunchpadFormView`."""
> super(BaseSnapEditView, self).setUpWidgets()
> widget = self.widgets.get('vcs')
> @@ -781,27 +803,11 @@ class SnapAdminView(BaseSnapEditView):
> # be removed once we back fill snap.information_type.
> return {'information_type': self.context.information_type}
>
> - def setUpWidgets(self):
> - super(SnapAdminView, self).setUpWidgets()
> - info_type_widget = self.widgets['information_type']
> - info_type_widget.vocabulary = InformationTypeVocabulary(
> - types=self.getInformationTypesToShow())
> -
> - def validate(self, data):
> - super(SnapAdminView, self).validate(data)
> - # BaseSnapEditView.validate checks the rules for 'private' in
> - # combination with other attributes.
> - if data.get('information_type', None) in PRIVATE_INFORMATION_TYPES:
> - if not getFeatureFlag(SNAP_PRIVATE_FEATURE_FLAG):
> - self.setFieldError(
> - 'information_type',
> - 'You do not have permission to create private snaps.')
> -
> def updateContextFromData(self, data, context=None, notify_modified=True):
> if 'project' in data:
> project = data.pop('project')
> self.context.setProject(project)
> - super(SnapAdminView, self).updateContextFromData(
> + super(BaseSnapEditView, self).updateContextFromData(
Not needed at all. It was a mistake (this method got moved back and forth while I was refactoring this part).
> data, context, notify_modified)
>
>
> @@ -892,6 +915,13 @@ class SnapEditView(BaseSnapEditView, EnableProcessorsMixin):
> # enabled. Leave it untouched.
> data['processors'].append(processor)
>
> + def updateContextFromData(self, data, context=None, notify_modified=True):
> + if 'project' in data:
> + project = data.pop('project')
> + self.context.setProject(project)
> + super(BaseSnapEditView, self).updateContextFromData(
Mistake again. Fixing it. Thanks!
> + data, context, notify_modified)
> +
>
> class SnapAuthorizeView(LaunchpadEditFormView):
> """View for authorizing snap package uploads to the store."""
--
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/399121
Your team Launchpad code reviewers is subscribed to branch ~pappacena/launchpad:snap-pillar-list-filters.
References