예제 #1
0
 def get_object_record(self, pid):
   """Get an object that has already been cached in the object tree.
   Caching happens when the object tree is refreshed.
   """
   try:
     return self._cache['records'][pid]
   except KeyError:
     raise onedrive_exceptions.ONEDriveException('Unknown PID')
예제 #2
0
 def _get_cache_folder_recursive(self, path, folder=None):
   logging.debug('path={}'.format(path))
   if folder is None:
     folder = self._cache['tree']
   if not path:
     return folder
   try:
     return self._get_cache_folder_recursive(path[1:], folder['dirs'][path[0]])
   except KeyError:
     raise onedrive_exceptions.ONEDriveException('Invalid path')
예제 #3
0
 def _get_uncached_object_record(self, pid):
   self._create_cache_item_for_pid(None, pid)
   try:
     return self._cache['records'][pid]
   except KeyError:
     raise onedrive_exceptions.ONEDriveException('Unknown PID')