~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/widgets/launchpadtarget.py

  • Committer: Curtis Hovey
  • Date: 2011-08-21 14:21:06 UTC
  • mto: This revision was merged to the branch mainline in revision 13745.
  • Revision ID: curtis.hovey@canonical.com-20110821142106-x93hajd6iguma8gx
Update test that was enforcing bad grammar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
    default_option = "package"
52
52
    _widgets_set_up = False
53
53
 
54
 
    def getDistributionVocabulary(self):
55
 
        return 'Distribution'
56
 
 
57
54
    def setUpSubWidgets(self):
58
55
        if self._widgets_set_up:
59
56
            return
69
66
                required=True, vocabulary='Product'),
70
67
            Choice(
71
68
                __name__='distribution', title=u"Distribution",
72
 
                required=True, vocabulary=self.getDistributionVocabulary(),
 
69
                required=True, vocabulary='Distribution',
73
70
                default=getUtility(ILaunchpadCelebrities).ubuntu),
74
71
            Choice(
75
72
                __name__='package', title=u"Package",
135
132
                    " Launchpad" % entered_name)
136
133
 
137
134
            if self.package_widget.hasInput():
138
 
                if bool(getFeatureFlag('disclosure.dsp_picker.enabled')):
139
 
                    self.package_widget.vocabulary.setDistribution(
140
 
                        distribution)
141
135
                try:
142
136
                    package_name = self.package_widget.getInputValue()
143
137
                except ConversionError:
149
143
                if package_name is None:
150
144
                    return distribution
151
145
                try:
152
 
                    if IDistributionSourcePackage.providedBy(package_name):
153
 
                        dsp = package_name
 
146
                    if bool(getFeatureFlag('disclosure.dsp_picker.enabled')):
 
147
                        vocab = self.package_widget.context.vocabulary
 
148
                        name = package_name.name
 
149
                        source_name = vocab.getTermByToken(name).value
154
150
                    else:
155
151
                        source_name = (
156
152
                            distribution.guessPublishedSourcePackageName(
157
153
                                package_name.name))
158
 
                        dsp = distribution.getSourcePackage(source_name)
159
154
                except NotFoundError:
160
155
                    raise LaunchpadValidationError(
161
156
                        "There is no package name '%s' published in %s"
162
157
                        % (package_name.name, distribution.displayname))
163
 
                return dsp
 
158
                return distribution.getSourcePackage(source_name)
164
159
            else:
165
160
                return distribution
166
161
        else: