Пример #1
0
 def copyMoveSingle(self, destPath, isMove):
     """See DAVResource.copyMoveSingle() """
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)               
     fpDest = self.provider._locToFilePath(destPath)
     assert not util.isEqualOrChildUri(self.path, destPath)
     # Create destination collection, if not exists
     if not os.path.exists(fpDest):
         os.mkdir(fpDest)
     try:
         # may raise: [Error 5] Permission denied: u'C:\\temp\\litmus\\ccdest'
         shutil.copystat(self._filePath, fpDest)
     except Exception, e:
         _logger.debug("Could not copy folder stats: %s" % e)
Пример #2
0
 def copyMoveSingle(self, destPath, isMove):
     """See DAVResource.copyMoveSingle() """
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)
     fpDest = self.provider._locToFilePath(destPath)
     assert not util.isEqualOrChildUri(self.path, destPath)
     # Create destination collection, if not exists
     if not os.path.exists(fpDest):
         os.mkdir(fpDest)
     try:
         # may raise: [Error 5] Permission denied: u'C:\\temp\\litmus\\ccdest'
         shutil.copystat(self._filePath, fpDest)
     except Exception, e:
         _logger.debug("Could not copy folder stats: %s" % e)
 def moveRecursive(self, destPath):
     """See DAVResource.moveRecursive() """
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)
     fpDest = self.provider._locToFilePath(destPath)
     assert not util.isEqualOrChildUri(self.path, destPath)
     assert not os.path.exists(fpDest)
     _logger.debug("moveRecursive(%s, %s)" % (self._filePath, fpDest))
     shutil.move(self._filePath, fpDest)
     # (Live properties are copied by copy2 or copystat)
     # Move dead properties
     if self.provider.propManager:
         destRes = self.provider.getResourceInst(destPath, self.environ)
         self.provider.propManager.moveProperties(self.getRefUrl(), destRes.getRefUrl(), withChildren=True)
Пример #4
0
 def moveRecursive(self, destPath):
     """See DAVResource.moveRecursive() """
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)
     fpDest = self.provider._locToFilePath(destPath)
     assert not util.isEqualOrChildUri(self.path, destPath)
     assert not os.path.exists(fpDest)
     _logger.debug("moveRecursive(%s, %s)" % (self._filePath, fpDest))
     shutil.move(self._filePath, fpDest)
     # (Live properties are copied by copy2 or copystat)
     # Move dead properties
     if self.provider.propManager:
         destRes = self.provider.getResourceInst(destPath, self.environ)
         self.provider.propManager.moveProperties(self.getRefUrl(), destRes.getRefUrl(),
                                                  withChildren=True)
 def copyMoveSingle(self, destPath, isMove):
     """See DAVResource.copyMoveSingle() """
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)
     fpDest = self.provider._locToFilePath(destPath)
     assert not util.isEqualOrChildUri(self.path, destPath)
     # Copy file (overwrite, if exists)
     shutil.copy2(self._filePath, fpDest)
     # (Live properties are copied by copy2 or copystat)
     # Copy dead properties
     propMan = self.provider.propManager
     if propMan:
         destRes = self.provider.getResourceInst(destPath, self.environ)
         if isMove:
             propMan.moveProperties(self.getRefUrl(), destRes.getRefUrl(), withChildren=False)
         else:
             propMan.copyProperties(self.getRefUrl(), destRes.getRefUrl())
Пример #6
0
 def copyMoveSingle(self, destPath, isMove):
     """See DAVResource.copyMoveSingle() """
     if self.provider.readonly:
         raise DAVError(HTTP_FORBIDDEN)
     fpDest = self.provider._locToFilePath(destPath)
     assert not util.isEqualOrChildUri(self.path, destPath)
     # Copy file (overwrite, if exists)
     shutil.copy2(self._filePath, fpDest)
     # (Live properties are copied by copy2 or copystat)
     # Copy dead properties
     propMan = self.provider.propManager
     if propMan:
         destRes = self.provider.getResourceInst(destPath, self.environ)
         if isMove:
             propMan.moveProperties(self.getRefUrl(), destRes.getRefUrl(),
                                    withChildren=False)
         else:
             propMan.copyProperties(self.getRefUrl(), destRes.getRefUrl())
Пример #7
0
 def isUrlLockedByToken(self, url, locktoken):
     """Check, if url (or any of it's parents) is locked by locktoken."""
     lockUrl = self.getLock(locktoken, "root")
     return lockUrl and util.isEqualOrChildUri(lockUrl, url)
Пример #8
0
 def isUrlLockedByToken(self, url, locktoken):
     """Check, if url (or any of it's parents) is locked by locktoken."""
     lockUrl = self.getLock(locktoken, "root")
     return lockUrl and util.isEqualOrChildUri(lockUrl, url)