Beispiel #1
0
 def load_from_store(self):
     if not self._store:
         raise AttributeError("No datastore defined!")
     if self._store.has_blob('all_keys'):
         data = Serializer.deserialize(self._store.get_blob('all_keys'))
         self.load_from_data(data)
         return True
     elif self._store.has_blob('all_keys_with_undefined'):
         data = Serializer.deserialize(self._store.get_blob('all_keys_with_undefined'))
         self.load_from_data(data,with_undefined = True)
         return True
     else:
         return False
Beispiel #2
0
 def load_config(self):
     config_file = self._path + "/config.json"
     if os.path.exists(config_file):
         with open(config_file, "rb") as config_file:
             self._config = Serializer.deserialize(config_file.read())
     else:
         self._config = {'indexes': {}}
         self.save_config()
Beispiel #3
0
 def load_config(self):
     config_file = self._path+"/config.json"
     if os.path.exists(config_file):
         with open(config_file,"rb") as config_file:
             self._config = Serializer.deserialize(config_file.read())
     else:
         self._config = {
             'indexes' : {}
         }
         self.save_config()
Beispiel #4
0
    def load_from_store(self):
        """Load index from store.

        :return: Whether index was correctly loaded or not
        :rtype: bool
        :raise AttributeError: If no datastore is defined

        """
        if not self._store:
            raise AttributeError('No datastore defined!')
        if self._store.has_blob('all_keys'):
            data = Serializer.deserialize(self._store.get_blob('all_keys'))
            self.load_from_data(data)
            return True
        elif self._store.has_blob('all_keys_with_undefined'):
            blob = self._store.get_blob('all_keys_with_undefined')
            data = Serializer.deserialize(blob)
            self.load_from_data(data, with_undefined=True)
            return True
        else:
            return False
Beispiel #5
0
    def load_from_store(self):
        """Load index from store.

        :return: Whether index was correctly loaded or not
        :rtype: bool
        :raise AttributeError: If no datastore is defined

        """
        if not self._store:
            raise AttributeError('No datastore defined!')
        if self._store.has_blob('all_keys'):
            data = Serializer.deserialize(self._store.get_blob('all_keys'))
            self.load_from_data(data)
            return True
        elif self._store.has_blob('all_keys_with_undefined'):
            blob = self._store.get_blob('all_keys_with_undefined')
            data = Serializer.deserialize(blob)
            self.load_from_data(data, with_undefined=True)
            return True
        else:
            return False
Beispiel #6
0
 def decode_attributes(self,data):
     return Serializer.deserialize(data)
Beispiel #7
0
 def decode_attributes(self, data):
     return Serializer.deserialize(data)