Beispiel #1
0
    def run(self):
        print("WsgiDAVServerThread.run()...")
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        # config = DEFAULT_CONFIG.copy()
        # config.update({
        config = {
            "provider_mapping": {
                "/": provider
            },
            "user_mapping": {},
            "host": SERVER_HOST,
            "port": SERVER_PORT,
            "enable_loggers": [
                # "http_authenticator",
                # "lock_manager",
            ],
            "debug_methods": [],
            "property_manager": True,  # True: use lock_manager.LockManager
            "lock_manager": True,  # True: use lock_manager.LockManager
            # None: domain_controller.WsgiDAVDomainController(user_mapping)
            "domain_controller": None,
            "verbose": 4,
        }

        if withAuthentication:
            config["user_mapping"] = {
                "/": {
                    "tester": {
                        "password": "******",
                        "description": "",
                        "roles": []
                    },
                    "tester2": {
                        "password": "******",
                        "description": "",
                        "roles": []
                    },
                }
            }
            config["http_authenticator"] = {
                "accept_basic": True,
                "accept_digest": False,
                "default_to_digest": False,
            }

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]),
                                    {"": app})

        print("WsgiDAVServerThread ext_server.serve_forever_stoppable()...")
        self.ext_server.serve_forever_stoppable()
        print("WsgiDAVServerThread ext_server stopped.")
        self.ext_server = None
Beispiel #2
0
    def run(self):
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        config = DEFAULT_CONFIG.copy()
        config.update({
            "provider_mapping": {
                "/": provider
            },
            "user_mapping": {},
            "host": "localhost",
            "port": 8080,
            "enable_loggers": [
                #                               "http_authenticator",
                #                               "lock_manager",
            ],
            "debug_methods": [],
            "propsmanager":
            True,  # True: use lock_manager.LockManager           
            "locksmanager":
            True,  # True: use lock_manager.LockManager                   
            "domaincontroller":
            None,  # None: domain_controller.WsgiDAVDomainController(user_mapping)
            "verbose": 2,
        })

        if withAuthentication:
            config["user_mapping"] = {
                "/": {
                    "tester": {
                        "password": "******",
                        "description": "",
                        "roles": [],
                    },
                    "tester2": {
                        "password": "******",
                        "description": "",
                        "roles": [],
                    },
                },
            }
            config["acceptbasic"] = True
            config["acceptdigest"] = False
            config["defaultdigest"] = False

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]),
                                    {"": app})

        self.ext_server.serve_forever_stoppable()
        self.ext_server = None
Beispiel #3
0
    def run(self):
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        config = DEFAULT_CONFIG.copy()
        config.update({
            "provider_mapping": {"/": provider},
            "user_mapping": {},
            "host": "localhost",
            "port": 8080,
            "enable_loggers": [
#                               "http_authenticator",
#                               "lock_manager",
                               ],
            "debug_methods": [ ],
            "propsmanager": True,      # True: use lock_manager.LockManager
            "locksmanager": True,      # True: use lock_manager.LockManager
            "domaincontroller": None,  # None: domain_controller.WsgiDAVDomainController(user_mapping)
            "verbose": 2,
            })

        if withAuthentication:
            config["user_mapping"] = {"/": {"tester": {"password": "******",
                                                       "description": "",
                                                       "roles": [],
                                                       },
                                            "tester2": {"password": "******",
                                                       "description": "",
                                                       "roles": [],
                                                       },
                                            },
                                      }
            config["acceptbasic"] = True
            config["acceptdigest"] = False
            config["defaultdigest"] = False

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]),
                                    {"": app})

        self.ext_server.serve_forever_stoppable()
        self.ext_server = None
Beispiel #4
0
class WsgiDAVServerThread(Thread):
    """WsgiDAV server that can be run in a parallel thread."""

    def __init__(self):
        self.ext_server = None
        Thread.__init__(self)

    def __del__(self):
        self.shutdown()

    def run(self):
        print("WsgiDAVServerThread.run()...")
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        config = DEFAULT_CONFIG.copy()
        config.update({
            "provider_mapping": {"/": provider},
            "user_mapping": {},
            "host": SERVER_HOST,
            "port": SERVER_PORT,
            "enable_loggers": [
                #                               "http_authenticator",
                #                               "lock_manager",
            ],
            "debug_methods": [],
            "propsmanager": True,      # True: use lock_manager.LockManager
            "locksmanager": True,      # True: use lock_manager.LockManager
            # None: domain_controller.WsgiDAVDomainController(user_mapping)
            "domaincontroller": None,
            "verbose": 2,
        })

        if withAuthentication:
            config["user_mapping"] = {"/": {"tester": {"password": "******",
                                                       "description": "",
                                                       "roles": [],
                                                       },
                                            "tester2": {"password": "******",
                                                        "description": "",
                                                        "roles": [],
                                                        },
                                            },
                                      }
            config["acceptbasic"] = True
            config["acceptdigest"] = False
            config["defaultdigest"] = False

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]),
                                    {"": app})

        print("WsgiDAVServerThread ext_server.serve_forever_stoppable()...")
        self.ext_server.serve_forever_stoppable()
        print("WsgiDAVServerThread ext_server stopped.")
        self.ext_server = None
#        print "WsgiDAVServerThread.run() terminated"

    def shutdown(self):
        if self.ext_server:
            print("WsgiDAVServerThread.shutdown()...")
            # let server process pending requests, otherwise shutdown might
            # lock
            time.sleep(.1)
            self.ext_server.stop_serve_forever()
            self.ext_server = None
            print("WsgiDAVServerThread.shutdown()... complete")
Beispiel #5
0
    def run(self):
        print("WsgiDAVServerThread.run()...")
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        # config = DEFAULT_CONFIG.copy()
        # config.update({
        config = {
            "provider_mapping": {"/": provider},
            "host": SERVER_HOST,
            "port": SERVER_PORT,
            # None: dc.simple_dc.SimpleDomainController(user_mapping)
            "http_authenticator": {"domain_controller": None},
            "simple_dc": {"user_mapping": {"*": True}},  # anonymous access
            "verbose": 4,
            "enable_loggers": [
                # "http_authenticator",
                # "lock_manager",
            ],
            "debug_methods": [],
            "property_manager": True,  # True: use lock_manager.LockManager
            "lock_manager": True,  # True: use lock_manager.LockManager
        }

        if withAuthentication:
            config["http_authenticator"].update(
                {
                    "accept_basic": True,
                    "accept_digest": False,
                    "default_to_digest": False,
                }
            )
            config["simple_dc"].update(
                {
                    "user_mapping": {
                        "/": {
                            "tester": {
                                "password": "******",
                                "description": "",
                                "roles": [],
                            },
                            "tester2": {
                                "password": "******",
                                "description": "",
                                "roles": [],
                            },
                        }
                    }
                }
            )

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]), {"": app})

        print("WsgiDAVServerThread ext_server.serve_forever_stoppable()...")
        self.ext_server.serve_forever_stoppable()
        print("WsgiDAVServerThread ext_server stopped.")
        self.ext_server = None
Beispiel #6
0
class WsgiDAVServerThread(Thread):
    """WsgiDAV server that can be run in a parallel thread."""

    def __init__(self):
        self.ext_server = None
        Thread.__init__(self)

    def __del__(self):
        self.shutdown()

    def run(self):
        print("WsgiDAVServerThread.run()...")
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        # config = DEFAULT_CONFIG.copy()
        # config.update({
        config = {
            "provider_mapping": {"/": provider},
            "host": SERVER_HOST,
            "port": SERVER_PORT,
            # None: dc.simple_dc.SimpleDomainController(user_mapping)
            "http_authenticator": {"domain_controller": None},
            "simple_dc": {"user_mapping": {"*": True}},  # anonymous access
            "verbose": 4,
            "enable_loggers": [
                # "http_authenticator",
                # "lock_manager",
            ],
            "debug_methods": [],
            "property_manager": True,  # True: use lock_manager.LockManager
            "lock_manager": True,  # True: use lock_manager.LockManager
        }

        if withAuthentication:
            config["http_authenticator"].update(
                {
                    "accept_basic": True,
                    "accept_digest": False,
                    "default_to_digest": False,
                }
            )
            config["simple_dc"].update(
                {
                    "user_mapping": {
                        "/": {
                            "tester": {
                                "password": "******",
                                "description": "",
                                "roles": [],
                            },
                            "tester2": {
                                "password": "******",
                                "description": "",
                                "roles": [],
                            },
                        }
                    }
                }
            )

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]), {"": app})

        print("WsgiDAVServerThread ext_server.serve_forever_stoppable()...")
        self.ext_server.serve_forever_stoppable()
        print("WsgiDAVServerThread ext_server stopped.")
        self.ext_server = None

    #        print "WsgiDAVServerThread.run() terminated"

    def shutdown(self):
        if self.ext_server:
            print("WsgiDAVServerThread.shutdown()...")
            # let server process pending requests, otherwise shutdown might
            # lock
            time.sleep(0.1)
            self.ext_server.stop_serve_forever()
            self.ext_server = None
            print("WsgiDAVServerThread.shutdown()... complete")
Beispiel #7
0
class WsgiDAVServerThread(Thread):
    """WsgiDAV server that can be run in a parallel thread."""

    def __init__(self):
        Thread.__init__(self)
        self.ext_server = None

    def __del__(self):
        self.shutdown()

    def run(self):
        withAuthentication = True
        self.rootpath = os.path.join(gettempdir(), "wsgidav-test")
        if not os.path.exists(self.rootpath):
            os.mkdir(self.rootpath)
        provider = FilesystemProvider(self.rootpath)

        config = DEFAULT_CONFIG.copy()
        config.update(
            {
                "provider_mapping": {"/": provider},
                "user_mapping": {},
                "host": "localhost",
                "port": 8080,
                "enable_loggers": [
                    #                               "http_authenticator",
                    #                               "lock_manager",
                ],
                "debug_methods": [],
                "propsmanager": True,  # True: use lock_manager.LockManager
                "locksmanager": True,  # True: use lock_manager.LockManager
                "domaincontroller": None,  # None: domain_controller.WsgiDAVDomainController(user_mapping)
                "verbose": 2,
            }
        )

        if withAuthentication:
            config["user_mapping"] = {
                "/": {
                    "tester": {"password": "******", "description": "", "roles": []},
                    "tester2": {"password": "******", "description": "", "roles": []},
                }
            }
            config["acceptbasic"] = True
            config["acceptdigest"] = False
            config["defaultdigest"] = False

        app = WsgiDAVApp(config)

        self.ext_server = ExtServer((config["host"], config["port"]), {"": app})

        self.ext_server.serve_forever_stoppable()
        self.ext_server = None

    #        print "WsgiDAVServerThread.run() terminated"

    def shutdown(self):
        if self.ext_server:
            #            print "WsgiDAVServerThread.shutdown()..."
            # let server process pending requests, otherwise shutdown might lock
            time.sleep(0.1)
            self.ext_server.stop_serve_forever()
            #            try:
            #                # since Python 2.6
            #                self.ext_server.shutdown()
            #            except AttributeError:
            #                pass
            self.ext_server = None