[Pythonmac-SIG] suggestion: use Internet Config for file creation types

Jack Jansen jack@oratrix.nl
Mon, 25 Oct 1999 13:52:19 +0200


> I think MacPython (both the IDE and the interpreter) should use Internet
> Config, to compute the type and creator of files that they create.

I thought about this at some point in the past, but decided against it. It 
tightly couples extensions to filetypes, as is done on Windows, and I think 
this is a bad thing in general.

What I could live with is if you did this optionally. I.e. if you do
    import autotyper
    autotyper.install()
somewhere in your script you get this behaviour. If you want to implement this 
I'll gladly accept it and add it to the distribution.

Note, by the way, that you don't need to write any C for this: there is in 
Internet config interface available, and you can hook into the standard open 
call with something like
import __builtin__

_builtin_open = __builtin__.open

def _open_with_typer(*args):
	rv = apply(_builtin_open, args)
	# do typer magic
	return rv

def install():
	__builtin__.open = _open_with_typer

--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm