(self, folder_alias, query=None)
return cache[cache_key]
Get a Folder object for this account.
Get a Folder object for this account.
Get a Folder object for this account .
def get_folder(self, folder_alias, query=None):
        '''
        Get a Folder object for this account.
        '''

        folder_name = folder_alias
        if folder_alias in self.settings['folders']:
            folder_name = self.settings['folders'][folder_alias]

        prefix = self.settings['folders'].get('prefix')
        if prefix and folder_alias != 'inbox':
            folder_name = f'{prefix}{folder_name}'

        # Is this a temporary query-based folder?
        cache = self.query_folders if query else self.folders
        cache_key = ''.join((folder_name, query)) if query else folder_name

        if cache_key not in cache:
            cache[cache_key] = Folder(
                folder_name, folder_alias,
                account=self,
                query=query,
            )

        return cache[cache_key]
def get_folder ( self , folder_alias , query = None ) : folder_name = folder_alias if folder_alias in self . settings [ 'folders' ] : folder_name = self . settings [ 'folders' ] [ folder_alias ] prefix = self . settings [ 'folders' ] . get ( 'prefix' ) if prefix and folder_alias != 'inbox' : folder_name = f'{prefix}{folder_name}' # Is this a temporary query-based folder? cache = self . query_folders if query else self . folders cache_key = '' . join ( ( folder_name , query ) ) if query else folder_name if cache_key not in cache : cache [ cache_key ] = Folder ( folder_name , folder_alias , account = self , query = query , ) return cache [ cache_key ]