當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。