+imports page should handle URL "hacks" more gracefully, instead of OOPS with LookupError

Bug #388997 reported by Ursula Junque
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Benji York
zope.app.form
Invalid
Undecided
Unassigned

Bug Description

As seen in OOPS-1261G540:
  LookupError: pot)

It oopses when a user tries to access a URL with a wrong filter_extension value, for instance:
https://translations.edge.launchpad.net/ubuntu/hardy/+source/gnome-control-center/+imports?field.filter_status=all&field.filter_extension=potaaaa

Related branches

Changed in rosetta:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

I think the bad URL came from here: http://logs.ubuntu-eu.org/free/2008/04/10/%23ubuntu-translators.html

The problem happens in this part of translation-import-queue-macros.pt:

            <tal:status
                 tal:replace="structure view/widgets/filter_extension/hidden" />

Without the "/hidden" part, the widget works just fine.

OOPS-1593G631, OOPS-1593L1388

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

AFAICT the exception should be caught in zope.app.form.browser.itemswidgets.SingleDataHelper.hidden:

    def hidden(self):
        #XXX: _getFormValue() should return a string value that can be
        # used in a HTML form, but it doesn't. When
        # http://www.zope.org/Collectors/Zope3-dev/584 gets fixed
        # this hack should be reverted.
        # -- Bjorn Tillenius, 2006-04-12
        value = self._getFormValue()
        if value == self._missing:
            form_value = ''
        else:
            form_value = self.vocabulary.getTerm(value).token
        return renderElement(u'input',
                             type='hidden',
                             name=self.name,
                             id=self.name,
                             value=form_value,
                             cssClass=self.cssClass,
                             extra=self.extra)

(Note that the bug referenced there is bug 98333, marked as "won't fix.")

Revision history for this message
Tres Seaver (tseaver) wrote :

Can you point the Zope guys to the code which triggers this bug? In particular, we don't have any clue about what kind of widget the 'filter_extension' is. You might decode the OOPS jargon for us, as well:: ideally, paste the traceback.

Changed in zope.app.form:
status: New → Incomplete
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Thanks for looking into this! I've copied the traceback from that oops into http://paste.ubuntu.com/439395/

filter_extension is a Choice using a SimpleVocabulary. The value we're getting here (due to a parenthesized URL being linkified incorrectly somewhere) is not in the vocabulary.

Revision history for this message
Benji York (benji) wrote :

This isn't a bug in zope.app.form. The SimpleVocabulary was behaving as designed. Launchpad just needed a simple subclass that would ignore bad values and use a default instead, which has now been done.

Changed in rosetta:
status: Triaged → Fix Committed
Changed in zope.app.form:
status: Incomplete → Invalid
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
Changed in rosetta:
assignee: nobody → Benji York (benji)
milestone: none → 10.08
tags: added: qa-needstesting
Revision history for this message
Benji York (benji) wrote :

Bug fix verified effective on staging.

tags: added: qa-ok
removed: qa-needstesting
Changed in rosetta:
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.