============
FTP handling
============

The FTP handler is responsible to check the status of, classify and allow or
deny checking of FTP URLs.

>>> from gocept.lms.ftp import FTP
>>> handler = FTP()


URL checking
============

XXX Setting up an FTP server isn't simple so we're using a real one for now:

Directories are detected and tried to be listed:

>>> handler.check('ftp://ftp.gocept.com/')
('ok', 'Directory successfully listed')

Individual files are tried to get transferred:

>>> handler.check('ftp://ftp.gocept.com/CMFAmazon/CMFAmazon-0.2.tar.gz')
('ok', 'Transfer successfully started.')

If a file doesn't exit, we mark the URL as `unavailable`:

>>> handler.check('ftp://ftp.gocept.com/knuddlhurz')
('unavailable', '450 /knuddlhurz: Not a regular file')

If the server doesn't respond, we mark it as `unavailable` as well:

>>> handler.check('ftp://no.server.example/knuddlhurz')
('unavailable', '...not known')
