예제 #1
0
파일: storage.py 프로젝트: leapcode/soledad
 def _init_shared_db(self):
     if not self._soledad.server_url:
         return None
     url = urlparse.urljoin(self._soledad.server_url, SHARED_DB_NAME)
     creds = self._creds
     db = SoledadSharedDatabase.open_database(url, creds)
     return db
예제 #2
0
 def setUp(self):
     BaseSoledadTest.setUp(self)
     self._shared_db = SoledadSharedDatabase(
         'https://provider/',
         ADDRESS,
         document_factory=SoledadDocument,
         creds=None)
예제 #3
0
 def _init_shared_db(self):
     if not self._soledad.server_url:
         return None
     url = urlparse.urljoin(self._soledad.server_url, SHARED_DB_NAME)
     creds = self._creds
     db = SoledadSharedDatabase.open_database(url, creds)
     return db
예제 #4
0
    def _shared_db(self):
        """
        Return an instance of the shared recovery database object.

        :return: The shared database.
        :rtype: SoledadSharedDatabase
        """
        if self._shared_db_instance is None:
            self._shared_db_instance = SoledadSharedDatabase.open_database(
                urlparse.urljoin(self.server_url, SHARED_DB_NAME),
                self._uuid,
                False,  # db should exist at this point.
                creds=self._creds)
        return self._shared_db_instance
예제 #5
0
    def _shared_db(self):
        """
        Return an instance of the shared recovery database object.

        :return: The shared database.
        :rtype: SoledadSharedDatabase
        """
        if self._shared_db_instance is None:
            self._shared_db_instance = SoledadSharedDatabase.open_database(
                urlparse.urljoin(self.server_url, SHARED_DB_NAME),
                self._uuid,
                False,  # db should exist at this point.
                creds=self._creds)
        return self._shared_db_instance
예제 #6
0
파일: api.py 프로젝트: rdoh/soledad
    def init_shared_db(self, server_url, uuid, creds, syncable=True):
        """
        Initialize the shared database.

        :param server_url: URL of the remote database.
        :type server_url: str
        :param uuid: The user's unique id.
        :type uuid: str
        :param creds: A tuple containing the authentication method and
            credentials.
        :type creds: tuple
        :param syncable:
            If syncable is False, the database will not attempt to sync against
            a remote replica.
        :type syncable: bool
        """
        # only case this is False is for testing purposes
        if self.shared_db is None:
            shared_db_url = urlparse.urljoin(server_url, SHARED_DB_NAME)
            self.shared_db = SoledadSharedDatabase.open_database(shared_db_url, uuid, creds=creds, syncable=syncable)
예제 #7
0
    def init_shared_db(self, server_url, uuid, creds, syncable=True):
        """
        Initialize the shared database.

        :param server_url: URL of the remote database.
        :type server_url: str
        :param uuid: The user's unique id.
        :type uuid: str
        :param creds: A tuple containing the authentication method and
            credentials.
        :type creds: tuple
        :param syncable:
            If syncable is False, the database will not attempt to sync against
            a remote replica.
        :type syncable: bool
        """
        # only case this is False is for testing purposes
        if self.shared_db is None:
            shared_db_url = urlparse.urljoin(server_url, SHARED_DB_NAME)
            self.shared_db = SoledadSharedDatabase.open_database(
                shared_db_url, uuid, creds=creds, syncable=syncable)
예제 #8
0
 def soledad_client(self, soledad_server, soledad_dbs):
     soledad_dbs('an-uuid')
     self._db = SoledadSharedDatabase.open_database(self.URL, self.CREDS)
예제 #9
0
 def soledad_client(self, soledad_server, soledad_dbs):
     soledad_dbs('an-uuid')
     self._db = SoledadSharedDatabase.open_database(self.URL, self.CREDS)