(self, remote_path_from, remote_path_to)
| 548 | threading.Thread(target=target).start() |
| 549 | |
| 550 | def copy(self, remote_path_from, remote_path_to): |
| 551 | |
| 552 | def header(remote_path_to): |
| 553 | |
| 554 | path = Urn(remote_path_to).path() |
| 555 | destination = "{root}{path}".format(root=self.webdav.root, path=path) |
| 556 | header_item = "Destination: {destination}".format(destination=destination) |
| 557 | |
| 558 | header = self.get_header('copy') |
| 559 | header.append(header_item) |
| 560 | |
| 561 | return header |
| 562 | |
| 563 | try: |
| 564 | urn_from = Urn(remote_path_from) |
| 565 | |
| 566 | if not self.check(urn_from.path()): |
| 567 | raise RemoteResourceNotFound(urn_from.path()) |
| 568 | |
| 569 | urn_to = Urn(remote_path_to) |
| 570 | |
| 571 | if not self.check(urn_to.parent()): |
| 572 | raise RemoteParentNotFound(urn_to.path()) |
| 573 | |
| 574 | url = {'hostname': self.webdav.hostname, 'root': self.webdav.root, 'path': urn_from.quote()} |
| 575 | options = { |
| 576 | 'URL': "{hostname}{root}{path}".format(**url), |
| 577 | 'CUSTOMREQUEST': Client.requests['copy'], |
| 578 | 'HTTPHEADER': header(remote_path_to) |
| 579 | } |
| 580 | |
| 581 | request = self.Request(options=options) |
| 582 | |
| 583 | request.perform() |
| 584 | request.close() |
| 585 | |
| 586 | except pycurl.error: |
| 587 | raise NotConnection(self.webdav.hostname) |
| 588 | |
| 589 | def move(self, remote_path_from, remote_path_to): |
| 590 |
no test coverage detected