Medusa on Macintosh [long]

Samuel Reynolds reynol@p...
Thu, 22 Feb 2001 21:48:29 -0700


---------------------- multipart/mixed attachment
Hi, all. Please go easy on a Python/Medusa newbie. ;-)
I just picked up Python (Mac Python 2.0) a few weeks ago,
and I'm working on getting Medusa up and running on Macintosh.
(I may try to move "up" to Zope, but the Medusa docs say that
it "should" work on Macintosh, whereas the Zope docs simply
say *nix and Windows.

A brief introduction:
I'm a professional software developer (mainly OO C++).
I've also done extensive scripting (including internet work)
in Frontier on Mac and Windows for several years (until very
recently, I was a Support Associate for Userland Software,
publisher of Frontier).

I just finished reading through the medusa@yahoogroups.com
archives.

In the process, I found I could hack os_filesystem and
http_server to make them work, but couldn't get ftp_server
to work with my changes. I kept getting bunches of extra
colons (the Mac filesystem path separator) in the paths,
so ftp_server couldn't find the files.

I have exchanged email directly with Sam Rushing about
this, but I'd like to open the discussion to the
development community.

Since os_filesystem is intended to function as a
virtual-*nix filesystem, I backed up and took another look.
I reverted to the original code (except for the date
coercions), and studied filesys.py. It seemed to make
an awful lot of calls to os.path (via self.path_module).
That's why there were so many glitches when I tried to
use it on Mac. It worked okay on Unix and Windows because
"/" is recognized as a proper path separator on both of
those systems. So I rewrote os_filesystem to always use
posixpath (i.e., the "/" separator) except when it had to
go to the actual files, and did the translation in only
one place (the translate method).

The FTP server suddenly worked perfectly, and the http
server (actually, default_handler.py) required only a
couple of small changes.

Other advantages this provides (as long as all file
references are processed via the os_filesystem):
o External code (servers, etc) only uses virtual-posix
paths (e.g., http server need do no translations).
o Mapping to os-specific paths is kept internal to
the os_filesystem. (Though, since the methods are
all public, the translate() method can be used by
client code if necessary.)
o I duplicated the various path and file/directory
methods in os_filesystem, so it can provide the
complete file-interaction abstraction.
o Except by going through the translate method to get
the actual system-specific file path, the client code
cannot pop out past the virtual-root directory
(i.e., can't pop out past "/").

I've attached the modified filesys.py file, as well
as a test program that exercises it.
I think it will work on other systems as-is, but
I'd appreciate if someone could try it out on Windows
and Unix. Any takers? (By all means, read through the
changed file first, so you understand exactly what it
does.) If I get the chance, I intend to test it on
Solaris and WinNT4, but I'd like to get alternate
input, as well--I'm sure there's code built on top
of Medusa that I'm not aware of, and that the changed
os_filesystem might adversely impact.

Note: In the test program (filesys_test.py), you may
need to add a section for your OS to set the real_*
paths as test reference values.

ON A SECOND TOPIC:
How can I get access to the CVS repository?
I saw the commands in the archive, but I'm running
the CVS client on a Mac, so it looks a bit different
from the Unix command-line access. MacCVS Pro asks for
server, path, login, and password. Perhaps I need to
contact Sam Rushing directly?

- Sam
---------------------- multipart/mixed attachment
A non-text attachment was scrubbed...
Name: filesys.py
Type: application/mac-binhex40
Size: 18341 bytes
Desc: not available
Url : http://mail.python.org/pipermail-21/medusa-dev/attachments/f26084b8/filesys.py

---------------------- multipart/mixed attachment
A non-text attachment was scrubbed...
Name: filesys_test.py
Type: application/mac-binhex40
Size: 9255 bytes
Desc: not available
Url : http://mail.python.org/pipermail-21/medusa-dev/attachments/72d724f0/filesys_test.py

---------------------- multipart/mixed attachment
________________________________________
Samuel Reynolds
Spinward Stars: http://www.spinwardstars.com/
Reynolds Virtual Workshop: http://www.primenet.com/~reynol
reynol@p...
samuel_reynolds@c...
---------------------- multipart/mixed attachment--