当前位置: 首页>>代码示例>>Python>>正文


Python DataLinker._insert方法代码示例

本文整理汇总了Python中dNG.data.data_linker.DataLinker._insert方法的典型用法代码示例。如果您正苦于以下问题:Python DataLinker._insert方法的具体用法?Python DataLinker._insert怎么用?Python DataLinker._insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dNG.data.data_linker.DataLinker的用法示例。


在下文中一共展示了DataLinker._insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _insert

# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _insert [as 别名]
	def _insert(self):
	#
		"""
Insert the instance into the database.

:since: v0.1.00
		"""

		with self.local.connection.no_autoflush:
		#
			DataLinker._insert(self)

			if (self.local.db_instance.time_published is None): self.local.db_instance.time_published = int(time())

			is_acl_missing = (len(self.local.db_instance.rel_acl) == 0)
			is_data_missing = self.is_data_attribute_none("owner_type")
			is_permission_missing = self.is_data_attribute_none("guest_permission", "user_permission")

			parent_object = (self.load_parent() if (is_acl_missing or is_data_missing or is_permission_missing) else None)
			is_parent_topic = isinstance(parent_object, Topic)

			if (is_data_missing and (is_parent_topic or isinstance(parent_object, List))):
			#
				parent_data = parent_object.get_data_attributes("id_site")

				if (self.local.db_instance.id_site is None and parent_data['id_site'] is not None): self.local.db_instance.id_site = parent_data['id_site']
				if (is_parent_topic): self.local.db_instance.position = parent_object._get_db_instance().posts
			#

			if (isinstance(parent_object, OwnableInstance)):
			#
				if (is_acl_missing): self._copy_acl_entries_from_instance(parent_object)
				if (is_permission_missing): self._copy_default_permission_settings_from_instance(parent_object)
开发者ID:dNG-git,项目名称:pas_discuss,代码行数:35,代码来源:post.py

示例2: _insert

# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _insert [as 别名]
    def _insert(self):
        """
Insert the instance into the database.

:since: v0.1.00
        """

        # pylint: disable=maybe-no-member

        DataLinker._insert(self)

        is_acl_missing = (len(self.local.db_instance.rel_acl) == 0)
        is_data_missing = self.is_data_attribute_none("owner_type")
        is_directory_mimeclass = (self.local.db_instance.mimeclass == "directory")
        is_permission_missing = self.is_data_attribute_none("guest_permission", "user_permission")

        parent_object = (self.load_parent()
                         if (is_acl_missing or is_data_missing or is_directory_mimeclass or is_permission_missing) else
                         None
                        )

        if (is_data_missing and isinstance(parent_object, DataLinker)):
            parent_data = parent_object.get_data_attributes("id_site")
            if (self.local.db_instance.id_site is None and parent_data['id_site'] is not None): self.local.db_instance.id_site = parent_data['id_site']
        #

        if (is_directory_mimeclass and isinstance(parent_object, Entry)): self.local.db_instance.mimetype = parent_object.get_mimetype()

        if (isinstance(parent_object, OwnableInstance)):
            if (is_acl_missing): self._copy_acl_entries_from_instance(parent_object)
            if (is_permission_missing): self._copy_default_permission_settings_from_instance(parent_object)
开发者ID:dNG-git,项目名称:pas_file_center,代码行数:33,代码来源:entry.py

示例3: _insert

# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _insert [as 别名]
    def _insert(self):
        """
Insert the instance into the database.

:since: v0.2.00
        """

        with self.local.connection.no_autoflush:
            DataLinker._insert(self)

            if (self.local.db_instance.time_published is None): self.local.db_instance.time_published = int(time())

            is_acl_missing = (len(self.local.db_instance.rel_acl) == 0)
            is_data_missing = self.is_data_attribute_none("owner_type", "entry_type")
            is_permission_missing = self.is_data_attribute_none("guest_permission", "user_permission")

            parent_object = (self.load_parent() if (is_acl_missing or is_data_missing or is_permission_missing) else None)

            if (is_data_missing and (isinstance(parent_object, Category) or isinstance(parent_object, Document))):
                parent_data = parent_object.get_data_attributes("id_site", "entry_type")

                if (self.local.db_instance.id_site is None and parent_data['id_site'] is not None): self.local.db_instance.id_site = parent_data['id_site']
                if (self.local.db_instance.entry_type is None): self.local.db_instance.entry_type = parent_data['entry_type']
            #

            if (isinstance(parent_object, OwnableInstance)):
                if (is_acl_missing): self._copy_acl_entries_from_instance(parent_object)
                if (is_permission_missing): self._copy_default_permission_settings_from_instance(parent_object)
开发者ID:dNG-git,项目名称:pas_contentor,代码行数:30,代码来源:document.py


注:本文中的dNG.data.data_linker.DataLinker._insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。