~landscape/zope3/ztk-1.1.3

« back to all changes in this revision

Viewing changes to src/zope/login/ftp.py

  • Committer: Sidnei da Silva
  • Date: 2010-07-05 21:07:01 UTC
  • Revision ID: sidnei.da.silva@canonical.com-20100705210701-zmqhqrbzad1mhzsl
- Reduce deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
##############################################################################
2
 
#
3
 
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
4
 
# All Rights Reserved.
5
 
#
6
 
# This software is subject to the provisions of the Zope Public License,
7
 
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8
 
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
 
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
 
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
 
# FOR A PARTICULAR PURPOSE
12
 
#
13
 
##############################################################################
14
 
 
15
 
from zope.authentication.loginpassword import LoginPassword
16
 
from zope.component import adapts
17
 
from zope.publisher.interfaces.ftp import IFTPCredentials
18
 
 
19
 
 
20
 
class FTPAuth(LoginPassword):
21
 
    """ILoginPassword adapter for handling common FTP authentication."""
22
 
 
23
 
    adapts(IFTPCredentials)
24
 
 
25
 
    def __init__(self, request):
26
 
        self.__request = request
27
 
        lpw = request._authUserPW()
28
 
        if lpw is None:
29
 
            login, password = None, None
30
 
        else:
31
 
            login, password = lpw
32
 
        super(FTPAuth, self).__init__(login, password)
33
 
 
34
 
    def needLogin(self, realm):
35
 
        self.__request.unauthorized("Did not work")