Пример #1
0
 def custom_book_importer(self, content, **keywords):
     """docstring is assigned a few lines down the line"""
     keyword = SOURCE.get_keyword_for_parameter(attribute)
     if keyword == "file_type":
         keywords[keyword] = attribute
         keywords["file_content"] = content
     else:
         keywords[keyword] = content
     sheets, filename, path = _get_book(**keywords)
     self.init(sheets=sheets, filename=filename, path=path)
Пример #2
0
 def custom_book_importer(self, content, **keywords):
     """docstring is assigned a few lines down the line"""
     keyword = SOURCE.get_keyword_for_parameter(attribute)
     if keyword == "file_type":
         keywords[keyword] = attribute
         keywords["file_content"] = content
     else:
         keywords[keyword] = content
     sheets, filename, path = _get_book(**keywords)
     self.init(sheets=sheets, filename=filename, path=path)
Пример #3
0
 def custom_importer1(self, content, **keywords):
     """docstring is assigned a few lines down the line"""
     sheet_params = {}
     for field in constants.VALID_SHEET_PARAMETERS:
         if field in keywords:
             sheet_params[field] = keywords.pop(field)
     keyword = SOURCE.get_keyword_for_parameter(attribute)
     if keyword == "file_type":
         keywords[keyword] = attribute
         keywords["file_content"] = content
     else:
         keywords[keyword] = content
     named_content = get_sheet_stream(**keywords)
     self.init(named_content.payload, named_content.name, **sheet_params)
Пример #4
0
    def custom_presenter(self, **keywords):
        """docstring is assigned a few lines down the line"""
        keyword = SOURCE.get_keyword_for_parameter(attribute)
        keywords[keyword] = attribute
        memory_source = source_getter(**keywords)
        memory_source.write_data(self)
        try:
            content_stream = memory_source.get_content()
            content = content_stream.getvalue()
        except AttributeError:
            # python 3 _io.TextWrapper
            content = None

        return content
Пример #5
0
    def custom_presenter(self, **keywords):
        """docstring is assigned a few lines down the line"""
        keyword = SOURCE.get_keyword_for_parameter(attribute)
        keywords[keyword] = attribute
        memory_source = source_getter(**keywords)
        memory_source.write_data(self)
        try:
            content_stream = memory_source.get_content()
            content = content_stream.getvalue()
        except AttributeError:
            # python 3 _io.TextWrapper
            content = None

        return content
Пример #6
0
 def custom_importer1(self, content, **keywords):
     """docstring is assigned a few lines down the line"""
     sheet_params = {}
     for field in constants.VALID_SHEET_PARAMETERS:
         if field in keywords:
             sheet_params[field] = keywords.pop(field)
     keyword = SOURCE.get_keyword_for_parameter(attribute)
     if keyword == "file_type":
         keywords[keyword] = attribute
         keywords["file_content"] = content
     else:
         keywords[keyword] = content
     named_content = get_sheet_stream(**keywords)
     self.init(named_content.payload,
               named_content.name, **sheet_params)