Mercurial > libervia-backend
comparison src/plugins/plugin_misc_file.py @ 1646:7f0c8856e4e1
plugin file: deferred XMLUI now use security limit
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 22 Nov 2015 21:25:09 +0100 |
parents | baac2e120600 |
children | 31b96ac3eec2 |
comparison
equal
deleted
inserted
replaced
1645:f1da3a8d08ce | 1646:7f0c8856e4e1 |
---|---|
45 SENDING_TITLE = D_(u'File sending') | 45 SENDING_TITLE = D_(u'File sending') |
46 CONFIRM = D_(u'{peer} wants to send the file "{name}" to you:\n{desc}\n\nThe file has a size of {size_human}\n\nDo you accept ?') | 46 CONFIRM = D_(u'{peer} wants to send the file "{name}" to you:\n{desc}\n\nThe file has a size of {size_human}\n\nDo you accept ?') |
47 CONFIRM_TITLE = D_(u'Confirm file transfer') | 47 CONFIRM_TITLE = D_(u'Confirm file transfer') |
48 CONFIRM_OVERWRITE = D_(u'File {} already exists, are you sure you want to overwrite ?') | 48 CONFIRM_OVERWRITE = D_(u'File {} already exists, are you sure you want to overwrite ?') |
49 CONFIRM_OVERWRITE_TITLE = D_(u'File exists') | 49 CONFIRM_OVERWRITE_TITLE = D_(u'File exists') |
50 SECURITY_LIMIT = 10 | |
50 | 51 |
51 PROGRESS_ID_KEY = 'progress_id' | 52 PROGRESS_ID_KEY = 'progress_id' |
52 | 53 |
53 | 54 |
54 class SatFile(object): | 55 class SatFile(object): |
320 _(CONFIRM_OVERWRITE_TITLE), | 321 _(CONFIRM_OVERWRITE_TITLE), |
321 action_extra={'meta_from_jid': peer_jid.full(), | 322 action_extra={'meta_from_jid': peer_jid.full(), |
322 'meta_type': C.META_TYPE_OVERWRITE, | 323 'meta_type': C.META_TYPE_OVERWRITE, |
323 'meta_progress_id': file_data[PROGRESS_ID_KEY] | 324 'meta_progress_id': file_data[PROGRESS_ID_KEY] |
324 }, | 325 }, |
326 security_limit=SECURITY_LIMIT, | |
325 profile=profile) | 327 profile=profile) |
326 exists_d.addCallback(check_overwrite) | 328 exists_d.addCallback(check_overwrite) |
327 return exists_d | 329 return exists_d |
328 | 330 |
329 self._openFileWrite(file_path, transfer_data, file_data, profile) | 331 self._openFileWrite(file_path, transfer_data, file_data, profile) |
367 options={C.XMLUI_DATA_FILETYPE: C.XMLUI_DATA_FILETYPE_DIR}, | 369 options={C.XMLUI_DATA_FILETYPE: C.XMLUI_DATA_FILETYPE_DIR}, |
368 action_extra={'meta_from_jid': peer_jid.full(), | 370 action_extra={'meta_from_jid': peer_jid.full(), |
369 'meta_type': C.META_TYPE_FILE, | 371 'meta_type': C.META_TYPE_FILE, |
370 'meta_progress_id': file_data[PROGRESS_ID_KEY] | 372 'meta_progress_id': file_data[PROGRESS_ID_KEY] |
371 }, | 373 }, |
374 security_limit=SECURITY_LIMIT, | |
372 profile=profile) | 375 profile=profile) |
373 d.addCallback(self._gotConfirmation, peer_jid, transfer_data, file_data, profile) | 376 d.addCallback(self._gotConfirmation, peer_jid, transfer_data, file_data, profile) |
374 return d | 377 return d |