(self, remote_directory, local_directory)
| 962 | raise NotConnection(self.webdav.hostname) |
| 963 | |
| 964 | def push(self, remote_directory, local_directory): |
| 965 | |
| 966 | def prune(src, exp): |
| 967 | return [sub(exp, "", item) for item in src] |
| 968 | |
| 969 | urn = Urn(remote_directory, directory=True) |
| 970 | |
| 971 | if not self.is_dir(urn.path()): |
| 972 | raise OptionNotValid(name="remote_path", value=remote_directory) |
| 973 | |
| 974 | if not os.path.isdir(local_directory): |
| 975 | raise OptionNotValid(name="local_path", value=local_directory) |
| 976 | |
| 977 | if not os.path.exists(local_directory): |
| 978 | raise LocalResourceNotFound(local_directory) |
| 979 | |
| 980 | paths = self.list(urn.path()) |
| 981 | expression = "{begin}{end}".format(begin="^", end=urn.path()) |
| 982 | remote_resource_names = prune(paths, expression) |
| 983 | |
| 984 | for local_resource_name in listdir(local_directory): |
| 985 | |
| 986 | local_path = os.path.join(local_directory, local_resource_name) |
| 987 | remote_path = "{remote_directory}{resource_name}".format(remote_directory=urn.path(), resource_name=local_resource_name) |
| 988 | |
| 989 | if os.path.isdir(local_path): |
| 990 | if not self.check(remote_path=remote_path): |
| 991 | self.mkdir(remote_path=remote_path) |
| 992 | self.push(remote_directory=remote_path, local_directory=local_path) |
| 993 | else: |
| 994 | if local_resource_name in remote_resource_names: |
| 995 | continue |
| 996 | self.upload_file(remote_path=remote_path, local_path=local_path) |
| 997 | |
| 998 | def pull(self, remote_directory, local_directory): |
| 999 |
no test coverage detected