Code review comment for lp:~wallyworld/launchpad/better-popup-show-widget-name

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

We solved this problem a few years ago.

    from lp.app.browser.stringformatter import FormattersAPI
    valid_content_id_or_class = FormattersAPI(self.context.name).css_id()

You may have several widgets for a field and there are two ways to make a valid class or id:
    widget_id = '%s-edit' % valid_content_id_or_class
or
    widget_id = FormattersAPI('%s-edit' % valid_content_id_or_class).css_id()

review: Needs Fixing (code)

« Back to merge proposal