[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Duplicity-talk] Fwd: AssertionError on every attempt
From: |
edgar . soldin |
Subject: |
Re: [Duplicity-talk] Fwd: AssertionError on every attempt |
Date: |
Tue, 09 Jun 2015 17:56:02 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
still smells hackish to me. an exception for the deletion can have many causes
and doesn't guarantee that there are no more other instances of that file on
the backend.
an approach like
1. list before upload
2. if one or more instances already, delete all
3. list again and raise error if there are still instances
would be more costly but also more secure. no?
reading
http://bazaar.launchpad.net/~duplicity-team/duplicity/0.7-series/view/head:/duplicity/backends/pydrivebackend.py
it looks like creating new file instances with the same name is possible by
design. reading here
http://pythonhosted.org/PyDrive/filemanagement.html#upload-and-update-file-content
suggests that "overwriting" a file would be retrieving the existing file and
SetContentFile() on the object again eg. something like
""" overwrite a possibly existing failed upload or create a new file """
id = self.id_by_name(remote_filename)
if id:
drive_file = self.drive.CreateFile({'id': id})
else:
drive_file = self.drive.CreateFile({'title': remote_filename, 'parents':
[{"kind": "drive#fileLink", "id": self.folder}]})
drive_file.SetContentFile(source_path.name)
drive_file.Upload()
..ede/duply.net
On 09.06.2015 17:22, Rupert Levene wrote:
> _delete removes one file at a time, but there can be any number of
> files with the same name and we need to remove them all.
>
> The loop will terminate when all the files are deleted since an
> exception will be raised in id_by_name.
>
> Rupert
>
> On 9 June 2015 at 16:13, <address@hidden> wrote:
>> why the endless loop? ..ede/duply.net
>>
>>
>> On 09.06.2015 17:09, Rupert Levene wrote:
>>> How about this?
>>>
>>> === modified file 'duplicity/backends/pydrivebackend.py'
>>> --- duplicity/backends/pydrivebackend.py 2015-05-31 19:14:43 +0000
>>> +++ duplicity/backends/pydrivebackend.py 2015-06-09 14:40:37 +0000
>>> @@ -84,6 +84,12 @@
>>> return ''
>>>
>>> def _put(self, source_path, remote_filename):
>>> + # delete files with same filename to avoid duplicates
>>> + while True:
>>> + try:
>>> + self._delete(remote_filename)
>>> + except:
>>> + break
>>> drive_file = self.drive.CreateFile({'title': remote_filename,
>>> 'parents': [{"kind": "drive#fileLink", "id": self.folder}]})
>>> drive_file.SetContentFile(source_path.name)
>>> drive_file.Upload()
>>>
>>>
>>> On 9 June 2015 at 09:49, <address@hidden> wrote:
>>>> On 09.06.2015 10:46, Rupert Levene wrote:
>>>>> Maybe this could be fixed by asking the server to delete the original
>>>>> upload (since duplicity believes it to be faulty) before reuploading?
>>>>
>>>> +1 ..ede/duply.net
>>>>
>>>>
>>>> _______________________________________________
>>>> Duplicity-talk mailing list
>>>> address@hidden
>>>> https://lists.nongnu.org/mailman/listinfo/duplicity-talk
>>>
>>> _______________________________________________
>>> Duplicity-talk mailing list
>>> address@hidden
>>> https://lists.nongnu.org/mailman/listinfo/duplicity-talk
>>>
>>
>> _______________________________________________
>> Duplicity-talk mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/duplicity-talk
>
> _______________________________________________
> Duplicity-talk mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/duplicity-talk
>
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, (continued)
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Rupert Levene, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Bruce Merry, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Scott McKenzie, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, edgar . soldin, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Scott McKenzie, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, edgar . soldin, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Scott McKenzie, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, edgar . soldin, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Scott McKenzie, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Rupert Levene, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt,
edgar . soldin <=
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Rupert Levene, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, edgar . soldin, 2015/06/09
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Rupert Levene, 2015/06/10
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, edgar . soldin, 2015/06/10
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Rupert Levene, 2015/06/10
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Bruce Merry, 2015/06/15
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, edgar . soldin, 2015/06/15
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Kenneth Loafman, 2015/06/15
- Re: [Duplicity-talk] Fwd: AssertionError on every attempt, Michael Terry, 2015/06/15
- [Duplicity-talk] Fix pydrive uploading multiple copies leading to Re: Fwd: AssertionError on every attempt, edgar . soldin, 2015/06/09