mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
parent
ce1c255152
commit
2170a4fce2
4 changed files with 5 additions and 4 deletions
|
|
@ -42,7 +42,8 @@ class NotFoundError(PreconditionFailed):
|
|||
|
||||
|
||||
class AlreadyExistingError(PreconditionFailed):
|
||||
'''Item already exists'''
|
||||
'''Item already exists.'''
|
||||
existing_href = None
|
||||
|
||||
|
||||
class WrongEtagError(PreconditionFailed):
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class FilesystemStorage(Storage):
|
|||
return fpath, get_etag_from_fileobject(f)
|
||||
except OSError as e:
|
||||
if e.errno == errno.EEXIST:
|
||||
raise exceptions.AlreadyExistingError(item)
|
||||
raise exceptions.AlreadyExistingError(existing_href=href)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class MemoryStorage(Storage):
|
|||
def upload(self, item):
|
||||
href = self._get_href(item)
|
||||
if href in self.items:
|
||||
raise exceptions.AlreadyExistingError(item)
|
||||
raise exceptions.AlreadyExistingError(existing_href=href)
|
||||
etag = _random_string()
|
||||
self.items[href] = (etag, item)
|
||||
return href, etag
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class SingleFileStorage(Storage):
|
|||
def upload(self, item):
|
||||
href = item.ident
|
||||
if href in self._items:
|
||||
raise exceptions.AlreadyExistingError(href)
|
||||
raise exceptions.AlreadyExistingError(existing_href=href)
|
||||
|
||||
self._items[href] = item, item.hash
|
||||
return href, item.hash
|
||||
|
|
|
|||
Loading…
Reference in a new issue