[Zope3-checkins] SVN: Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/ Remove requirement for zope.server

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Apr 20 12:56:04 EDT 2005


Log message for revision 30062:
  Remove requirement for zope.server
  
  

Changed:
  A   Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/demofs.py
  U   Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/test_ftpview.py

-=-
Added: Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/demofs.py
===================================================================
--- Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/demofs.py	2005-04-20 16:55:27 UTC (rev 30061)
+++ Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/demofs.py	2005-04-20 16:56:03 UTC (rev 30062)
@@ -0,0 +1,63 @@
+##############################################################################
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+##############################################################################
+"""Demo file-system implementation, for testing
+
+$Id: demofs.py 27459 2004-09-07 01:45:52Z shane $
+"""
+execute = 1
+read = 2
+write = 4
+
+class File(object):
+    type = 'f'
+    modified=None
+
+    def __init__(self):
+        self.access = {'anonymous': read}
+
+    def accessable(self, user, access=read):
+        return (user == 'root'
+                or (self.access.get(user, 0) & access)
+                or (self.access.get('anonymous', 0) & access)
+                )
+
+    def grant(self, user, access):
+        self.access[user] = self.access.get(user, 0) | access
+
+    def revoke(self, user, access):
+        self.access[user] = self.access.get(user, 0) ^ access
+
+class Directory(File):
+
+    type = 'd'
+
+    def __init__(self):
+        super(Directory, self).__init__()
+        self.files = {}
+
+    def get(self, name, default=None):
+        return self.files.get(name, default)
+
+    def __getitem__(self, name):
+        return self.files[name]
+
+    def __setitem__(self, name, v):
+        self.files[name] = v
+
+    def __delitem__(self, name):
+        del self.files[name]
+
+    def __contains__(self, name):
+        return name in self.files
+
+    def __iter__(self):
+        return iter(self.files)


Property changes on: Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/demofs.py
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/test_ftpview.py
===================================================================
--- Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/test_ftpview.py	2005-04-20 16:55:27 UTC (rev 30061)
+++ Zope3/branches/srichter-twisted-integration/src/zope/app/ftp/tests/test_ftpview.py	2005-04-20 16:56:03 UTC (rev 30062)
@@ -21,8 +21,6 @@
 
 from zope.interface import implements
 
-import zope.server.ftp.tests.demofs as demofs
-
 from zope.app.testing import ztapi
 from zope.app.filerepresentation.interfaces import IReadFile, IWriteFile
 from zope.app.filerepresentation.interfaces import IReadDirectory
@@ -38,6 +36,8 @@
 from zope.app.container.contained import setitem, Contained
 from zope.app.container.interfaces import IContainer
 
+import demofs
+
 class Directory(demofs.Directory, Contained):
 
     implements(IReadDirectory, IWriteDirectory, IFileFactory,



More information about the Zope3-Checkins mailing list