本文整理汇总了Python中babel.messages.catalog.Catalog.revision_date方法的典型用法代码示例。如果您正苦于以下问题:Python Catalog.revision_date方法的具体用法?Python Catalog.revision_date怎么用?Python Catalog.revision_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类babel.messages.catalog.Catalog
的用法示例。
在下文中一共展示了Catalog.revision_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build
# 需要导入模块: from babel.messages.catalog import Catalog [as 别名]
# 或者: from babel.messages.catalog.Catalog import revision_date [as 别名]
def _build(self, locale, messages, path, pathGlobal=None):
'''
Builds a catalog based on the provided locale paths, the path is used as the main source any messages that are not
found in path locale but are part of messages will attempt to be extracted from the global path locale.
@param locale: Locale
The locale.
@param messages: Iterable(Message)
The messages to build the PO file on.
@param path: string
The path of the targeted PO file from the locale repository.
@param pathGlobal: string|None
The path of the global PO file from the locale repository.
@return: file like object
File like object that contains the PO file content
'''
assert isinstance(locale, Locale), 'Invalid locale %s' % locale
assert isinstance(messages, Iterable), 'Invalid messages %s' % messages
assert isinstance(path, str), 'Invalid path %s' % path
assert pathGlobal is None or isinstance(pathGlobal, str), 'Invalid global path %s' % pathGlobal
if isfile(path):
with open(path) as fObj: catalog = read_po(fObj, locale)
else:
catalog = Catalog(locale, creation_date=datetime.now(), **self.catalog_config)
if pathGlobal and isfile(pathGlobal):
with open(pathGlobal) as fObj: catalogGlobal = read_po(fObj, locale)
else:
catalogGlobal = None
self._processCatalog(catalog, messages, fallBack=catalogGlobal)
catalog.revision_date = datetime.now()
return catalog