本文整理汇总了Python中xierpa3.toolbox.transformer.TX.asGetMethodName方法的典型用法代码示例。如果您正苦于以下问题:Python TX.asGetMethodName方法的具体用法?Python TX.asGetMethodName怎么用?Python TX.asGetMethodName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xierpa3.toolbox.transformer.TX
的用法示例。
在下文中一共展示了TX.asGetMethodName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import asGetMethodName [as 别名]
def get(self, contentID=None, **kwargs):
u"""
This get method is the core routine to make the adapter produce content.
There is a dispatcher level to search for an adapter method that matches
the contentID.
All adapter method need to answer a Data instance, where the requested data is embedded
as one of the attributes @(article.text, article.url, article.chapters)@.
"""
article = hook = None
if contentID is not None:
hook = TX.asGetMethodName(contentID)
if hasattr(self, hook):
article = getattr(self, hook)(**kwargs)
if article is None:
message = '[%s] Could not find adapter.%s()' % (self, hook)
article = self.newArticle(error=message, text=message)
print article.error
return article