def init(self): """ init is called after event listeners were added to the store instance """ ## throw exception if store directory does not exist if not self.__file_system.path_exists(self.__path): ## look for renamed or removed store folder self.__handle_renamed_removed_store() if not self.__file_system.path_exists(self.__path): #print self.__path raise StoreInitError, self.trUtf8("The specified store directory does not exist! %s" % self.__path) return ## look for store/describing_nav/categorising_nav/expire directories names (all languages) if they do not exist if not self.__file_system.path_exists(self.__path + "/" + self.__storage_dir_name): for dir in self.__storage_dir_list: if self.__file_system.path_exists(self.__path + "/" + dir): self.__storage_dir_name = unicode(dir) if not self.__file_system.path_exists(self.__path + "/" + self.__describing_nav_dir_name): for dir in self.__describing_nav_dir_list: if self.__file_system.path_exists(self.__path + "/" + dir): self.__describing_nav_dir_name = unicode(dir) if not self.__file_system.path_exists(self.__path + "/" + self.__categorising_nav_dir_name): for dir in self.__categorising_nav_dir_list: if self.__file_system.path_exists(self.__path + "/" + dir): self.__categorising_nav_dir_name = unicode(dir) if not self.__file_system.path_exists(self.__path + "/" + self.__expiry_dir_name): for dir in self.__expiry_dir_list: if self.__file_system.path_exists(self.__path + "/" + dir): self.__expiry_dir_name = unicode(dir) if not self.__file_system.path_exists(self.__path + "/" + self.__navigation_dir_name): for dir in self.__expiry_dir_list: if self.__file_system.path_exists(self.__path + "/" + dir): self.__navigation_dir_name = unicode(dir) ## built stores directories and config file if they currently not exist (new store) self.__file_system.create_dir(self.__path + "/" + self.__storage_dir_name) self.__file_system.create_dir(self.__path + "/" + self.__expiry_dir_name) self.__file_system.create_dir(self.__path + "/" + self.__config_file_name.split("/")[0]) self.__file_system.create_dir(self.__path + "/" + self.__navigation_dir_name) ## create config/vocabulary files if they don't exist if not self.__file_system.path_exists(self.__path + "/" + self.__config_file_name): ConfigWrapper.create_store_config_file(self.__path + "/" + self.__config_file_name) ## now create a new config_wrapper instance self.__store_config_wrapper = ConfigWrapper(self.__path + "/" + self.__config_file_name) if not self.__file_system.path_exists(self.__path + "/" + self.__tags_file_name): TagWrapper.create_tags_file(self.__path + "/" + self.__tags_file_name) ## now create a new tag_wrapper instance self.__tag_wrapper = TagWrapper(self.__path + "/" + self.__tags_file_name) if not self.__file_system.path_exists(self.__path + "/" + self.__vocabulary_file_name): self.__vocabulary_wrapper = VocabularyWrapper.create_vocabulary_file(self.__path + "/" + self.__vocabulary_file_name) ## 0 ... show just the describing tagline -> create the NAVIGATION dir ## 3 ... show just the categorizing tagline - only restricted vocabulary is allowed -> create the CATEGORIES dir ## ELSE: two taglines with dirs: CATEGORIES/DESCRIPTIONS self.__tagline_config = self.__store_config_wrapper.get_show_category_line() # clear the old list (if there is already one) self.__paths_to_maintain = [] if self.__tagline_config == 0: #self.__file_system.create_dir(self.__path + "/" + self.__navigation_dir_name) self.__paths_to_maintain.append(self.__path + "/" + self.__navigation_dir_name) elif self.__tagline_config == 3: #self.__file_system.create_dir(self.__path + "/" + self.__categorising_nav_dir_name) self.__paths_to_maintain.append(self.__path + "/" + self.__categorising_nav_dir_name) else: #self.__file_system.create_dir(self.__path + "/" + self.__categorising_nav_dir_name) self.__paths_to_maintain.append(self.__path + "/" + self.__categorising_nav_dir_name) #self.__file_system.create_dir(self.__path + "/" + self.__describing_nav_dir_name) self.__paths_to_maintain.append(self.__path + "/" + self.__describing_nav_dir_name) for path in self.__paths_to_maintain: self.__file_system.create_dir(path) self.__init_store()