(self, remote_path_from, remote_path_to)
| 587 | raise NotConnection(self.webdav.hostname) |
| 588 | |
| 589 | def move(self, remote_path_from, remote_path_to): |
| 590 | |
| 591 | def header(remote_path_to): |
| 592 | |
| 593 | path = Urn(remote_path_to).path() |
| 594 | destination = "{root}{path}".format(root=self.webdav.root, path=path) |
| 595 | header_item = "Destination: {destination}".format(destination=destination) |
| 596 | header = self.get_header('move') |
| 597 | header.append(header_item) |
| 598 | return header |
| 599 | |
| 600 | try: |
| 601 | urn_from = Urn(remote_path_from) |
| 602 | |
| 603 | if not self.check(urn_from.path()): |
| 604 | raise RemoteResourceNotFound(urn_from.path()) |
| 605 | |
| 606 | urn_to = Urn(remote_path_to) |
| 607 | |
| 608 | if not self.check(urn_to.parent()): |
| 609 | raise RemoteParentNotFound(urn_to.path()) |
| 610 | |
| 611 | url = {'hostname': self.webdav.hostname, 'root': self.webdav.root, 'path': urn_from.quote()} |
| 612 | options = { |
| 613 | 'URL': "{hostname}{root}{path}".format(**url), |
| 614 | 'CUSTOMREQUEST': Client.requests['move'], |
| 615 | 'HTTPHEADER': header(remote_path_to) |
| 616 | } |
| 617 | |
| 618 | request = self.Request(options=options) |
| 619 | |
| 620 | request.perform() |
| 621 | request.close() |
| 622 | |
| 623 | except pycurl.error: |
| 624 | raise NotConnection(self.webdav.hostname) |
| 625 | |
| 626 | def clean(self, remote_path): |
| 627 |
no test coverage detected