コード例 #1
0
    def initialize(self):
        """Remove some fields based on the entry handled."""
        self.field_names = [
            "file_type",
            "path",
            "sourcepackagename",
            "potemplate",
            "potemplate_name",
            "name",
            "translation_domain",
            "languagepack",
            "language",
        ]

        if self.context.productseries is not None:
            # We are handling an entry for a productseries, this field is not
            # useful here.
            self.field_names.remove("sourcepackagename")

        if not self.context.is_targeted_to_ubuntu:
            # Only show languagepack for Ubuntu packages.
            self.field_names.remove("languagepack")

        # Execute default initialization.
        LaunchpadFormView.initialize(self)
コード例 #2
0
 def initialize(self):
     """Initialize the view to handle the request."""
     LaunchpadFormView.initialize(self)
     bug_id = self.request.form.get("id")
     if bug_id:
         self._redirectToBug(bug_id)
     elif self.widgets['scope'].hasInput():
         self._validate(action=None, data={})
コード例 #3
0
 def initialize(self):
     LaunchpadFormView.initialize(self)
     # Update the submit label based on the user's permission.
     submit_action = self.__class__.actions.byname["actions.submit"]
     if self.userIsReleaseManager():
         submit_action.label = _("Target")
     elif self.userIsBugSupervisor():
         submit_action.label = _("Nominate")
     else:
         self.request.response.addErrorNotification("You do not have permission to nominate this bug.")
         self.request.response.redirect(canonical_url(self.current_bugtask))
コード例 #4
0
ファイル: language.py プロジェクト: vitaminmoo/unnaturalcode
    def initialize(self):
        """See `LaunchpadFormView`."""
        LaunchpadFormView.initialize(self)

        self.language_search = None

        search_lang_widget = self.widgets.get('search_lang')
        if (search_lang_widget is not None and
            search_lang_widget.hasValidInput()):
            self.language_search = search_lang_widget.getInputValue()
        self.search_requested = self.language_search is not None
コード例 #5
0
ファイル: browser.py プロジェクト: pombreda/UnnaturalCodeFork
 def initialize(self):
     """Initialize the view when a Bug may be reported for the Question."""
     question = self.context
     if question.bugs:
         # we can't make a bug when we have linked bugs
         self.request.response.addErrorNotification(
             _('You cannot create a bug report from a question'
               'that already has bugs linked to it.'))
         self.request.response.redirect(canonical_url(question))
         return
     LaunchpadFormView.initialize(self)
コード例 #6
0
    def initialize(self):
        """See `LaunchpadFormView`."""
        LaunchpadFormView.initialize(self)

        self.language_search = None

        search_lang_widget = self.widgets.get('search_lang')
        if (search_lang_widget is not None
                and search_lang_widget.hasValidInput()):
            self.language_search = search_lang_widget.getInputValue()
        self.search_requested = self.language_search is not None
コード例 #7
0
 def initialize(self):
     """Initialize the view when a Bug may be reported for the Question."""
     question = self.context
     if question.bugs:
         # we can't make a bug when we have linked bugs
         self.request.response.addErrorNotification(
             _('You cannot create a bug report from a question'
               'that already has bugs linked to it.'))
         self.request.response.redirect(canonical_url(question))
         return
     LaunchpadFormView.initialize(self)
コード例 #8
0
 def initialize(self):
     LaunchpadFormView.initialize(self)
     # Update the submit label based on the user's permission.
     submit_action = self.__class__.actions.byname['actions.submit']
     if self.userCanTarget():
         submit_action.label = _("Target")
     elif self.userCanNominate():
         submit_action.label = _("Nominate")
     else:
         self.request.response.addErrorNotification(
             "You do not have permission to nominate this bug.")
         self.request.response.redirect(canonical_url(self.current_bugtask))
コード例 #9
0
    def initialize(self):
        """Remove some fields based on the entry handled."""
        self.field_names = [
            'file_type', 'path', 'sourcepackagename', 'potemplate',
            'potemplate_name', 'name', 'translation_domain', 'languagepack',
            'language'
        ]

        if self.context.sourcepackagename is None:
            # We are handling an entry for a productseries, so these
            # fields are not useful here.
            self.field_names.remove('languagepack')
            self.field_names.remove('sourcepackagename')

        # Execute default initialization.
        LaunchpadFormView.initialize(self)
コード例 #10
0
ファイル: build.py プロジェクト: pombredanne/launchpad-3
    def initialize(self):
        """See `ILaunchpadFormView`.

        It redirects attempts to rescore builds that cannot be rescored
        to the build context page, so the current page-scrapping libraries
        won't cause any oops.

        It also sets next_url and cancel_url to the build context page, so
        any action will send the user back to the context build page.
        """
        build_url = canonical_url(self.context)
        self.next_url = self.cancel_url = build_url

        if not self.context.can_be_rescored:
            self.request.response.redirect(build_url)

        LaunchpadFormView.initialize(self)
コード例 #11
0
ファイル: build.py プロジェクト: pombreda/UnnaturalCodeFork
    def initialize(self):
        """See `ILaunchpadFormView`.

        It redirects attempts to rescore builds that cannot be rescored
        to the build context page, so the current page-scrapping libraries
        won't cause any oops.

        It also sets next_url and cancel_url to the build context page, so
        any action will send the user back to the context build page.
        """
        build_url = canonical_url(self.context)
        self.next_url = self.cancel_url = build_url

        if not self.context.can_be_rescored:
            self.request.response.redirect(build_url)

        LaunchpadFormView.initialize(self)
コード例 #12
0
    def initialize(self):
        """Remove some fields based on the entry handled."""
        self.field_names = [
            'file_type', 'path', 'sourcepackagename', 'potemplate',
            'potemplate_name', 'name', 'translation_domain', 'languagepack',
            'language'
        ]

        if self.context.productseries is not None:
            # We are handling an entry for a productseries, this field is not
            # useful here.
            self.field_names.remove('sourcepackagename')

        if not self.context.is_targeted_to_ubuntu:
            # Only show languagepack for Ubuntu packages.
            self.field_names.remove('languagepack')

        # Execute default initialization.
        LaunchpadFormView.initialize(self)
コード例 #13
0
 def initialize(self):
     """See `LaunchpadFormView`."""
     self._initial_values = {}
     LaunchpadFormView.initialize(self)
コード例 #14
0
ファイル: branch.py プロジェクト: pombredanne/launchpad-3
 def initialize(self):
     """Show a 404 if the branch target doesn't support proposals."""
     if not self.context.target.supports_merge_proposals:
         raise NotFound(self.context, '+register-merge')
     LaunchpadFormView.initialize(self)
コード例 #15
0
 def initialize(self):
     """See `LaunchpadFormView`."""
     self._initial_values = {}
     LaunchpadFormView.initialize(self)