本文整理汇总了Python中dNG.data.data_linker.DataLinker._analyze_structure方法的典型用法代码示例。如果您正苦于以下问题:Python DataLinker._analyze_structure方法的具体用法?Python DataLinker._analyze_structure怎么用?Python DataLinker._analyze_structure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dNG.data.data_linker.DataLinker
的用法示例。
在下文中一共展示了DataLinker._analyze_structure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _analyze_structure
# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _analyze_structure [as 别名]
def _analyze_structure(self, cache_id = None):
#
"""
Analyzes the entry structure, the number of total topics, values and
identifies the latest entry based on the main ID and list ID of this
instance.
:param cache_id: ID used for building the structure SQLAlchemy query and
cache its result.
:since: v0.1.00
"""
if (self.log_handler is not None): self.log_handler.debug("#echo(__FILEPATH__)# -{0!r}._analyze_structure()- (#echo(__LINE__)#)", self, context = "pas_datalinker")
with self:
#
if (cache_id is None): cache_id = "DiscussList:{0}".format(self.local.db_instance.id_main)
permission_user_id = self.get_permission_user_id()
DataLinker._analyze_structure(self, cache_id)
self.latest_timestamp = -1
self.total_topics = 0
self.total_posts = 0
for entry in self.structure_instance.get_structure_list(self.local.db_instance.id):
#
is_readable = True
if (isinstance(entry, OwnableInstance)):
#
entry.set_permission_user_id(permission_user_id)
is_readable = entry.is_readable()
#
if (is_readable and (not entry.is_data_attribute_none("topics", "posts"))):
#
entry_data = entry.get_data_attributes("time_sortable", "topics", "posts", "last_id_topic", "last_id_author", "last_preview")
self.total_topics += entry_data['topics']
self.total_posts += entry_data['posts']
if (entry_data['last_id_topic'] is not None and entry_data['time_sortable'] > self.latest_timestamp):
#
self.latest_timestamp = entry_data['time_sortable']
self.latest_topic_id = entry_data['last_id_topic']
self.latest_author_id = entry_data['last_id_author']
self.latest_preview = entry_data['last_preview']