[CalendarServer-changes] [5972] CalendarServer/branches/new-store-no-caldavfile-2
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 3 19:40:51 PDT 2010
Revision: 5972
http://trac.macosforge.org/projects/calendarserver/changeset/5972
Author: cdaboo at apple.com
Date: 2010-08-03 19:40:50 -0700 (Tue, 03 Aug 2010)
Log Message:
-----------
Remove DAVFile from principals.
Modified Paths:
--------------
CalendarServer/branches/new-store-no-caldavfile-2/calendarserver/tap/util.py
CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/calendaruserproxy.py
CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/principal.py
CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/util.py
CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/extensions.py
CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/resource.py
Modified: CalendarServer/branches/new-store-no-caldavfile-2/calendarserver/tap/util.py
===================================================================
--- CalendarServer/branches/new-store-no-caldavfile-2/calendarserver/tap/util.py 2010-08-04 00:56:23 UTC (rev 5971)
+++ CalendarServer/branches/new-store-no-caldavfile-2/calendarserver/tap/util.py 2010-08-04 02:40:50 UTC (rev 5972)
@@ -46,7 +46,6 @@
from twistedcaldav.directory.internal import InternalDirectoryService
from twistedcaldav.directory.principal import DirectoryPrincipalProvisioningResource
from twistedcaldav.directory.sudo import SudoDirectoryService
-from twistedcaldav.directory.util import NotFilePath
from twistedcaldav.directory.wiki import WikiDirectoryService
from twistedcaldav.directorybackedaddressbook import DirectoryBackedAddressBookResource
from twistedcaldav.notify import installNotificationClient
@@ -382,7 +381,6 @@
% (iScheduleResourceClass,))
ischedule = iScheduleResourceClass(
- NotFilePath(isfile=True),
root,
)
root.putChild("ischedule", ischedule)
Modified: CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/calendaruserproxy.py 2010-08-04 00:56:23 UTC (rev 5971)
+++ CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/calendaruserproxy.py 2010-08-04 02:40:50 UTC (rev 5972)
@@ -42,11 +42,11 @@
from twistedcaldav.config import config, fullServerPath
from twistedcaldav.database import AbstractADBAPIDatabase, ADBAPISqliteMixin,\
ADBAPIPostgreSQLMixin
-from twistedcaldav.extensions import DAVFile, DAVPrincipalResource
+from twistedcaldav.extensions import DAVPrincipalResource,\
+ DAVResourceWithChildrenMixin
from twistedcaldav.extensions import ReadOnlyWritePropertiesResourceMixIn
from twistedcaldav.memcacher import Memcacher
from twistedcaldav.resource import CalDAVComplianceMixIn
-from twistedcaldav.directory.util import NotFilePath
class PermissionsMixIn (ReadOnlyWritePropertiesResourceMixIn):
def defaultAccessControlList(self):
@@ -80,7 +80,7 @@
# Permissions here are fixed, and are not subject to inheritance rules, etc.
return succeed(self.defaultAccessControlList())
-class CalendarUserProxyPrincipalResource (CalDAVComplianceMixIn, PermissionsMixIn, DAVPrincipalResource, DAVFile):
+class CalendarUserProxyPrincipalResource (CalDAVComplianceMixIn, PermissionsMixIn, DAVResourceWithChildrenMixin, DAVPrincipalResource):
"""
Calendar user proxy principal resource.
"""
@@ -96,7 +96,8 @@
url = joinURL(parent.principalURL(), proxyType) + slash
- super(CalendarUserProxyPrincipalResource, self).__init__(NotFilePath(isdir=True), url)
+ super(CalendarUserProxyPrincipalResource, self).__init__()
+ DAVResourceWithChildrenMixin.__init__(self)
self.parent = parent
self.proxyType = proxyType
Modified: CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/principal.py 2010-08-04 00:56:23 UTC (rev 5971)
+++ CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/principal.py 2010-08-04 02:40:50 UTC (rev 5972)
@@ -56,8 +56,8 @@
from twistedcaldav.directory import augment
from twistedcaldav.directory.calendaruserproxy import CalendarUserProxyPrincipalResource
from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord
-from twistedcaldav.directory.util import NotFilePath
-from twistedcaldav.extensions import ReadOnlyResourceMixIn, DAVFile, DAVPrincipalResource
+from twistedcaldav.extensions import ReadOnlyResourceMixIn, DAVPrincipalResource,\
+ DAVResourceWithChildrenMixin
from twistedcaldav.resource import CalendarPrincipalCollectionResource, CalendarPrincipalResource
from twistedcaldav.directory.idirectory import IDirectoryService
from twistedcaldav import caldavxml, customxml
@@ -70,10 +70,6 @@
# Use __underbars__ convention to avoid conflicts with directory resource types.
uidsResourceName = "__uids__"
-# FIXME: These should not be tied to DAVFile
-# The reason that they is that web2.dav only implements DAV methods on
-# DAVFile instead of DAVResource. That should change.
-
class PermissionsMixIn (ReadOnlyResourceMixIn):
def defaultAccessControlList(self):
return authReadACL
@@ -131,7 +127,6 @@
class DirectoryProvisioningResource (
PermissionsMixIn,
CalendarPrincipalCollectionResource,
- DAVFile,
):
def __init__(self, url, directory):
"""
@@ -141,7 +136,7 @@
assert url.endswith("/"), "Collection URL must end in '/'"
CalendarPrincipalCollectionResource.__init__(self, url)
- DAVFile.__init__(self, NotFilePath(isdir=True))
+ DAVResourceWithChildrenMixin.__init__(self)
self.directory = IDirectoryService(directory)
@@ -507,7 +502,7 @@
def principalCollections(self):
return self.parent.principalCollections()
-class DirectoryPrincipalResource (PermissionsMixIn, DAVPrincipalResource, DAVFile):
+class DirectoryPrincipalResource (PermissionsMixIn, DAVPrincipalResource):
"""
Directory principal resource.
"""
@@ -526,7 +521,7 @@
@param parent: the parent of this resource.
@param record: the L{IDirectoryRecord} that this resource represents.
"""
- super(DirectoryPrincipalResource, self).__init__(NotFilePath(isdir=True))
+ super(DirectoryPrincipalResource, self).__init__()
if self.isCollection():
slash = "/"
Modified: CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/util.py
===================================================================
--- CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/util.py 2010-08-04 00:56:23 UTC (rev 5971)
+++ CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/directory/util.py 2010-08-04 02:40:50 UTC (rev 5972)
@@ -20,9 +20,10 @@
__all__ = [
"uuidFromName",
- "NotFilePath",
]
+from txdav.idav import AlreadyFinishedError
+
from uuid import UUID, uuid5
def uuidFromName(namespace, name):
@@ -38,153 +39,6 @@
return str(uuid5(UUID(namespace), name))
-import errno
-import time
-from twext.python.filepath import CachingFilePath as FilePath
-from txdav.idav import AlreadyFinishedError
-
-class NotFilePath(FilePath):
- """
- Dummy placeholder for FilePath for when we don't actually want a file.
- Pretends to be an empty file or directory.
- """
- def __init__(self, isfile=False, isdir=False, islink=False):
- assert isfile or isdir or islink
-
- self._isfile = isfile
- self._isdir = isdir
- self._islink = islink
-
- self._time = time.time()
-
- def __cmp__(self, other):
- if not isinstance(other, self.__class__):
- return NotImplemented
- return cmp(
- ( self.isdir(), self.isfile(), self.islink()),
- (other.isdir(), other.isfile(), other.islink()),
- )
-
- def __repr__(self):
- types = []
- if self.isdir():
- types.append("dir")
- if self.isfile():
- types.append("file")
- if self.islink():
- types.append("link")
- if types:
- return "<%s (%s)>" % (self.__class__.__name__, ",".join(types))
- else:
- return "<%s>" % (self.__class__.__name__,)
-
- def _unimplemented(self, *args):
- try:
- raise NotImplementedError("NotFilePath isn't really a FilePath: psych!")
- except NotImplementedError:
- from twisted.python.failure import Failure
- Failure().printTraceback()
- raise
-
- child = _unimplemented
- preauthChild = _unimplemented
- siblingExtensionSearch = _unimplemented
- siblingExtension = _unimplemented
- open = _unimplemented
- clonePath = _unimplemented # Cuz I think it's dumb
-
- def childSearchPreauth(self, *paths):
- return ()
-
- def splitext(self):
- return ("", "")
-
- def basename(self):
- return ""
-
- def dirname(self):
- return ""
-
- def changed(self):
- pass
-
- def restat(self, reraise=True):
- pass
-
- def getsize(self):
- return 0
-
- def _time(self):
- return self._time
-
- # FIXME: Maybe we should have separate ctime, mtime, atime. Meh.
- getModificationTime = _time
- getStatusChangeTime = _time
- getAccessTime = _time
-
- def exists(self):
- return True
-
- def isdir(self):
- return self._isdir
-
- def isfile(self):
- return self._isfile
-
- def islink(self):
- return self._islink
-
- def isabs(self):
- return True
-
- def listdir(self):
- return ()
-
- def touch(self):
- self._time = time.time()
-
- def _notAllowed(self):
- raise OSError(errno.EACCES, "Permission denied")
-
- remove = _notAllowed
- setContent = _notAllowed
-
- def globChildren(self, pattern):
- return ()
-
- def parent(self):
- return self.__class__(isdir=True)
-
- def createDirectory(self):
- if self.isdir():
- raise OSError(errno.EEXIST, "File exists")
- else:
- return self._notAllowed
-
- makedirs = createDirectory
-
- def create(self):
- if self.isfile():
- raise OSError(errno.EEXIST, "File exists")
- else:
- return self._notAllowed
-
- def temporarySibling(self):
- return self.__class__(isfile=True)
-
- def copyTo(self, destination):
- if self.isdir():
- if not destination.isdir():
- destination.createDirectory()
- elif self.isfile():
- destination.open("w").close()
- else:
- raise NotImplementedError()
-
- moveTo = _notAllowed
-
-
-
def transactionFromRequest(request, newStore):
"""
Return the associated transaction from the given HTTP request, creating a
Modified: CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/extensions.py 2010-08-04 00:56:23 UTC (rev 5971)
+++ CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/extensions.py 2010-08-04 02:40:50 UTC (rev 5972)
@@ -705,7 +705,6 @@
return self.renderDirectory(request)
return super(DAVResource, self).render(request)
-
def resourceType(self):
# Allow live property to be overridden by dead property
if self.deadProperties().contains((dav_namespace, "resourcetype")):
@@ -778,6 +777,14 @@
http_REPORT = http_REPORT
+ def render(self, request):
+ if not self.exists():
+ return responsecode.NOT_FOUND
+
+ if self.isCollection():
+ return self.renderDirectory(request)
+ return super(DAVResource, self).render(request)
+
@inlineCallbacks
def readProperty(self, property, request):
if type(property) is tuple:
Modified: CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/resource.py
===================================================================
--- CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/resource.py 2010-08-04 00:56:23 UTC (rev 5971)
+++ CalendarServer/branches/new-store-no-caldavfile-2/twistedcaldav/resource.py 2010-08-04 02:40:50 UTC (rev 5972)
@@ -71,7 +71,6 @@
from twistedcaldav.datafilters.peruserdata import PerUserDataFilter
from twistedcaldav.datafilters.privateevents import PrivateEventFilter
from twistedcaldav.directory.internal import InternalDirectoryRecord
-from twistedcaldav.dropbox import DropBoxHomeResource
from twistedcaldav.extensions import DAVResource, DAVPrincipalResource,\
PropertyNotFoundError, DAVResourceWithChildrenMixin
from twistedcaldav.ical import Component
@@ -1889,7 +1888,7 @@
),
)
-class CalendarPrincipalResource (CalDAVComplianceMixIn, DAVPrincipalResource):
+class CalendarPrincipalResource (CalDAVComplianceMixIn, DAVResourceWithChildrenMixin, DAVPrincipalResource):
"""
CalDAV principal resource.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100803/e4fe6a91/attachment-0001.html>
More information about the calendarserver-changes
mailing list