Parse the url or load the settings from settings object.
(self, url=None, *args, **kwargs)
| 52 | key_t = str |
| 53 | |
| 54 | def __init__(self, url=None, *args, **kwargs): |
| 55 | """Parse the url or load the settings from settings object.""" |
| 56 | super().__init__(*args, **kwargs) |
| 57 | |
| 58 | if py_arango_connection is None: |
| 59 | raise ImproperlyConfigured( |
| 60 | 'You need to install the pyArango library to use the ' |
| 61 | 'ArangoDb backend.', |
| 62 | ) |
| 63 | |
| 64 | self.url = url |
| 65 | |
| 66 | if url is None: |
| 67 | host = port = database = collection = username = password = None |
| 68 | else: |
| 69 | ( |
| 70 | _schema, host, port, username, password, |
| 71 | database_collection, _query |
| 72 | ) = _parse_url(url) |
| 73 | if database_collection is None: |
| 74 | database = collection = None |
| 75 | else: |
| 76 | database, collection = database_collection.split('/') |
| 77 | |
| 78 | config = self.app.conf.get('arangodb_backend_settings', None) |
| 79 | if config is not None: |
| 80 | if not isinstance(config, dict): |
| 81 | raise ImproperlyConfigured( |
| 82 | 'ArangoDb backend settings should be grouped in a dict', |
| 83 | ) |
| 84 | else: |
| 85 | config = {} |
| 86 | |
| 87 | self.host = host or config.get('host', self.host) |
| 88 | self.port = int(port or config.get('port', self.port)) |
| 89 | self.http_protocol = config.get('http_protocol', self.http_protocol) |
| 90 | self.verify = config.get('verify', self.verify) |
| 91 | self.database = database or config.get('database', self.database) |
| 92 | self.collection = \ |
| 93 | collection or config.get('collection', self.collection) |
| 94 | self.username = username or config.get('username', self.username) |
| 95 | self.password = password or config.get('password', self.password) |
| 96 | self.arangodb_url = "{http_protocol}://{host}:{port}".format( |
| 97 | http_protocol=self.http_protocol, host=self.host, port=self.port |
| 98 | ) |
| 99 | self._connection = None |
| 100 | |
| 101 | @property |
| 102 | def connection(self): |
nothing calls this directly
no test coverage detected