ftpserver.py 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/usr/bin/env python
  2. # -*- coding:utf8 -*-
  3. # $Id: ftpserver.py 1171 2013-02-19 10:13:09Z g.rodola $
  4. # ======================================================================
  5. # Copyright (C) 2007-2013 Giampaolo Rodola' <g.rodola@gmail.com>
  6. #
  7. # All Rights Reserved
  8. #
  9. # Permission is hereby granted, free of charge, to any person
  10. # obtaining a copy of this software and associated documentation
  11. # files (the "Software"), to deal in the Software without
  12. # restriction, including without limitation the rights to use,
  13. # copy, modify, merge, publish, distribute, sublicense, and/or sell
  14. # copies of the Software, and to permit persons to whom the
  15. # Software is furnished to do so, subject to the following
  16. # conditions:
  17. #
  18. # The above copyright notice and this permission notice shall be
  19. # included in all copies or substantial portions of the Software.
  20. #
  21. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  23. # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  25. # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  26. # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  27. # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  28. # OTHER DEALINGS IN THE SOFTWARE.
  29. #
  30. # ======================================================================
  31. """
  32. Note: this module is here only for backward compatibility.
  33. The new import system which is supposed to be used is:
  34. from pyftpdlib.handlers import FTPHandler, TLS_FTPHandler, ...
  35. from pyftpdlib.authorizers import DummyAuthorizer, UnixAuthorizer, ...
  36. from pyftpdlib.servers import FTPServer, ...
  37. """
  38. from pyftpdlib.log import logger
  39. from pyftpdlib.handlers import *
  40. from pyftpdlib.authorizers import *
  41. from pyftpdlib.servers import *
  42. from pyftpdlib import _depwarn, __ver__
  43. __all__ = ['proto_cmds', 'Error', 'log', 'logline', 'logerror', 'DummyAuthorizer',
  44. 'AuthorizerError', 'FTPHandler', 'FTPServer', 'PassiveDTP',
  45. 'ActiveDTP', 'DTPHandler', 'ThrottledDTPHandler', 'FileProducer',
  46. 'BufferedIteratorProducer', 'AbstractedFS']
  47. _depwarn("pyftpdlib.ftpserver module is deprecated")
  48. class CallLater(object):
  49. def __init__(self, *args, **kwargs):
  50. _depwarn("CallLater is deprecated; use "
  51. "pyftpdlib.ioloop.IOLoop.instance().call_later() instead")
  52. from pyftpdlib.ioloop import IOLoop
  53. IOLoop.instance().call_later(*args, **kwargs)
  54. class CallEvery(object):
  55. def __init__(self, *args, **kwargs):
  56. _depwarn("CallEvery is deprecated; use "
  57. "pyftpdlib.ioloop.IOLoop.instance().call_every() instead")
  58. from pyftpdlib.ioloop import IOLoop
  59. IOLoop.instance().call_every(*args, **kwargs)
  60. def log(msg):
  61. _depwarn("pyftpdlib.ftpserver.log() is deprecated")
  62. logger.info(msg)
  63. def logline(msg):
  64. _depwarn("pyftpdlib.ftpserver.logline() is deprecated")
  65. logger.debug(msg)
  66. def logerror(msg):
  67. _depwarn("pyftpdlib.ftpserver.logline() is deprecated")
  68. logger.error(msg)
  69. if __name__ == '__main__':
  70. from pyftpdlib import main
  71. main()