Author dalke
Recipients dalke
Date 2009-10-23.14:07:34
SpamBayes Score 1.00915e-10
Marked as misclassified No
Message-id <1256306857.19.0.981560840081.issue7192@psf.upfronthosting.co.za>
In-reply-to
Content
I have Firefox and Safari installed on my Mac. Safari is the default.

I wanted to try out Crunchy (http://code.google.com/p/crunchy/). It's 
developed under Firefox and does not work under Safari. I tried. ;)

It starts the web browser with the following.

    try:
        client = webbrowser.get("firefox")
        client.open(url)
        return
    except:
        try:
            client = webbrowser.get()
            client.open(url)
            return
        except:
            print('Please open %s in Firefox.' % url)

On my Mac, webbrowser.get("firefox") fails, so this ends up opening in 
Safari. Which does not work to view the code.

Thing is, I have Firefox installed, so it should work. But the Mac code in 
webbrowser appears to only open in the default browser.

The following bit of code works well enough to get crunchy to work

    class MacOSXFirefox(BaseBrowser):
        def open(self, url, new=0, autoraise=True):
            subprocess.check_call(["/usr/bin/open", "-b", 
"org.mozilla.firefox", url])

    register("firefox", None, MacOSXFirefox('firefox'), -1)

but I don't know enough about the Mac nor about webbrowser to know if I'm 
the right path. For example, I don't know if there are ways to support 
'new' and 'autoraise' through /usr/bin/open or if there's a better 
solution.

Attached is the full diff.
History
Date User Action Args
2009-10-23 14:07:37dalkesetrecipients: + dalke
2009-10-23 14:07:37dalkesetmessageid: <1256306857.19.0.981560840081.issue7192@psf.upfronthosting.co.za>
2009-10-23 14:07:35dalkelinkissue7192 messages
2009-10-23 14:07:34dalkecreate