本文整理汇总了Python中genshi.filters.Transformer.apply方法的典型用法代码示例。如果您正苦于以下问题:Python Transformer.apply方法的具体用法?Python Transformer.apply怎么用?Python Transformer.apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类genshi.filters.Transformer
的用法示例。
在下文中一共展示了Transformer.apply方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate
# 需要导入模块: from genshi.filters import Transformer [as 别名]
# 或者: from genshi.filters.Transformer import apply [as 别名]
def generate(self, *args, **kwargs):
"creates the RelatorioStream."
serializer = OOSerializer(self._zip_source)
kwargs['__relatorio_make_href'] = ImageHref(serializer.outzip,
serializer.manifest,
kwargs)
kwargs['__relatorio_make_dimension'] = ImageDimension(self.namespaces)
kwargs['__relatorio_guess_type'] = guess_type
counter = ColumnCounter()
kwargs['__relatorio_reset_col_count'] = counter.reset
kwargs['__relatorio_inc_col_count'] = counter.inc
kwargs['__relatorio_store_col_count'] = counter.store
cache = ExpressionCache()
kwargs['__relatorio_store_cache'] = cache.store
kwargs['__relatorio_get_cache'] = cache.get
stream = super(Template, self).generate(*args, **kwargs)
if self.has_col_loop:
# Note that we can't simply add a "number-columns-repeated"
# attribute and then fill it with the correct number of columns
# because that wouldn't work if more than one column is repeated.
transformation = DuplicateColumnHeaders(counter)
col_filter = Transformer('//repeat[namespace-uri()="%s"]'
% RELATORIO_URI)
col_filter = col_filter.apply(transformation)
stream = Stream(list(stream), self.serializer) | col_filter
return RelatorioStream(stream, serializer)