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


Python DataLinker._ensure_db_class方法代码示例

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


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

示例1: load_owner_root_directory

# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _ensure_db_class [as 别名]
    def load_owner_root_directory(cls, owner_id):
        """
Load Entry instance of the root directory for the given owner ID.

:param cls: Expected encapsulating database instance class
:param owner_id: Owner ID

:return: (object) Entry instance on success
:since:  v0.1.00
        """

        if (owner_id is None): raise NothingMatchedException("Owner ID is invalid")

        with Connection.get_instance():
            db_instance = (DataLinker.get_db_class_query(cls)
                           .filter(_DbFileCenterEntry.vfs_type == Entry.VFS_TYPE_DIRECTORY,
                                   _DbFileCenterEntry.role_id == "owner_root",
                                   _DbFileCenterEntry.owner_type == "u",
                                   _DbFileCenterEntry.owner_id == owner_id
                                  )
                           .first()
                          )

            if (db_instance is None): raise NothingMatchedException("Owner ID '{0}' is invalid".format(owner_id))
            DataLinker._ensure_db_class(cls, db_instance)

            return Entry(db_instance)
开发者ID:dNG-git,项目名称:pas_file_center,代码行数:29,代码来源:entry.py

示例2: load_vfs_url

# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _ensure_db_class [as 别名]
    def load_vfs_url(cls, url):
        """
Load Entry instance by its VFS URL.

:param cls: Expected encapsulating database instance class
:param url: VFS URL

:return: (object) Entry instance on success
:since:  v0.1.00
        """

        if (url is None): raise NothingMatchedException("VFS URL is invalid")

        with Connection.get_instance():
            db_instance = DataLinker.get_db_class_query(cls).filter(_DbFileCenterEntry.vfs_url == url).first()

            if (db_instance is None): raise NothingMatchedException("VFS URL '{0}' is invalid".format(url))
            DataLinker._ensure_db_class(cls, db_instance)

            return Entry(db_instance)
开发者ID:dNG-git,项目名称:pas_file_center,代码行数:22,代码来源:entry.py

示例3: load_role_id

# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _ensure_db_class [as 别名]
    def load_role_id(cls, _id):
        """
Load Entry instance by its role ID.

:param cls: Expected encapsulating database instance class
:param _id: Role ID

:return: (object) Entry instance on success
:since:  v0.1.00
        """

        if (_id is None): raise NothingMatchedException("Role ID is invalid")

        with Connection.get_instance():
            db_instance = DataLinker.get_db_class_query(cls).filter(_DbFileCenterEntry.role_id == _id).first()

            if (db_instance is None): raise NothingMatchedException("Role ID '{0}' is invalid".format(_id))
            DataLinker._ensure_db_class(cls, db_instance)

            return Entry(db_instance)
开发者ID:dNG-git,项目名称:pas_file_center,代码行数:22,代码来源:entry.py

示例4: load_id_subscription

# 需要导入模块: from dNG.data.data_linker import DataLinker [as 别名]
# 或者: from dNG.data.data_linker.DataLinker import _ensure_db_class [as 别名]
	def load_id_subscription(cls, _id):
	#
		"""
Load List instance by its subscription ID.

:param cls: Expected encapsulating database instance class
:param _id: Subscription ID

:return: (object) List instance on success
:since:  v0.1.00
		"""

		if (_id is None): raise NothingMatchedException("List subscription ID is invalid")

		with Connection.get_instance():
		#
			db_instance = DataLinker.get_db_class_query(cls).filter(_DbDiscussList.id_subscription == _id).first()

			if (db_instance is None): raise NothingMatchedException("List subscription '{0}' is invalid".format(_id))
			DataLinker._ensure_db_class(cls, db_instance)

			return List(db_instance)
开发者ID:dNG-git,项目名称:pas_discuss,代码行数:24,代码来源:list.py


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