當前位置: 首頁>>代碼示例>>Python>>正文


Python exc.DontWrapMixin方法代碼示例

本文整理匯總了Python中sqlalchemy.exc.DontWrapMixin方法的典型用法代碼示例。如果您正苦於以下問題:Python exc.DontWrapMixin方法的具體用法?Python exc.DontWrapMixin怎麽用?Python exc.DontWrapMixin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sqlalchemy.exc的用法示例。


在下文中一共展示了exc.DontWrapMixin方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: instance

# 需要導入模塊: from sqlalchemy import exc [as 別名]
# 或者: from sqlalchemy.exc import DontWrapMixin [as 別名]
def instance(cls, statement, params,
                        orig,
                        dbapi_base_err,
                        connection_invalidated=False):
        # Don't ever wrap these, just return them directly as if
        # DBAPIError didn't exist.
        if isinstance(orig, (KeyboardInterrupt, SystemExit, DontWrapMixin)):
            return orig

        if orig is not None:
            # not a DBAPI error, statement is present.
            # raise a StatementError
            if not isinstance(orig, dbapi_base_err) and statement:
                msg = traceback.format_exception_only(
                    orig.__class__, orig)[-1].strip()
                return StatementError(
                    "%s (original cause: %s)" % (str(orig), msg),
                    statement, params, orig
                )

            name, glob = orig.__class__.__name__, globals()
            if name in glob and issubclass(glob[name], DBAPIError):
                cls = glob[name]

        return cls(statement, params, orig, connection_invalidated) 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:27,代碼來源:exc.py

示例2: instance

# 需要導入模塊: from sqlalchemy import exc [as 別名]
# 或者: from sqlalchemy.exc import DontWrapMixin [as 別名]
def instance(cls, statement, params,
                 orig, dbapi_base_err,
                 connection_invalidated=False,
                 dialect=None):
        # Don't ever wrap these, just return them directly as if
        # DBAPIError didn't exist.
        if (isinstance(orig, BaseException) and
                not isinstance(orig, Exception)) or \
                isinstance(orig, DontWrapMixin):
            return orig

        if orig is not None:
            # not a DBAPI error, statement is present.
            # raise a StatementError
            if not isinstance(orig, dbapi_base_err) and statement:
                return StatementError(
                    "(%s.%s) %s" %
                    (orig.__class__.__module__, orig.__class__.__name__,
                     orig),
                    statement, params, orig
                )

            glob = globals()
            for super_ in orig.__class__.__mro__:
                name = super_.__name__
                if dialect:
                    name = dialect.dbapi_exception_translation_map.get(
                        name, name)
                if name in glob and issubclass(glob[name], DBAPIError):
                    cls = glob[name]
                    break

        return cls(statement, params, orig, connection_invalidated) 
開發者ID:jpush,項目名稱:jbox,代碼行數:35,代碼來源:exc.py

示例3: instance

# 需要導入模塊: from sqlalchemy import exc [as 別名]
# 或者: from sqlalchemy.exc import DontWrapMixin [as 別名]
def instance(cls, statement, params,
                 orig, dbapi_base_err,
                 connection_invalidated=False,
                 dialect=None):
        # Don't ever wrap these, just return them directly as if
        # DBAPIError didn't exist.
        if (isinstance(orig, BaseException) and
                not isinstance(orig, Exception)) or \
                isinstance(orig, DontWrapMixin):
            return orig

        if orig is not None:
            # not a DBAPI error, statement is present.
            # raise a StatementError
            if isinstance(orig, SQLAlchemyError) and statement:
                return StatementError(
                    "(%s.%s) %s" %
                    (orig.__class__.__module__, orig.__class__.__name__,
                     orig.args[0]),
                    statement, params, orig, code=orig.code
                )
            elif not isinstance(orig, dbapi_base_err) and statement:
                return StatementError(
                    "(%s.%s) %s" %
                    (orig.__class__.__module__, orig.__class__.__name__,
                     orig),
                    statement, params, orig
                )

            glob = globals()
            for super_ in orig.__class__.__mro__:
                name = super_.__name__
                if dialect:
                    name = dialect.dbapi_exception_translation_map.get(
                        name, name)
                if name in glob and issubclass(glob[name], DBAPIError):
                    cls = glob[name]
                    break

        return cls(statement, params, orig, connection_invalidated,
                   code=cls.code) 
開發者ID:yfauser,項目名稱:planespotter,代碼行數:43,代碼來源:exc.py

示例4: instance

# 需要導入模塊: from sqlalchemy import exc [as 別名]
# 或者: from sqlalchemy.exc import DontWrapMixin [as 別名]
def instance(cls, statement, params,
                 orig, dbapi_base_err,
                 connection_invalidated=False):
        # Don't ever wrap these, just return them directly as if
        # DBAPIError didn't exist.
        if isinstance(orig, (KeyboardInterrupt, SystemExit, DontWrapMixin)):
            return orig

        if orig is not None:
            # not a DBAPI error, statement is present.
            # raise a StatementError
            if not isinstance(orig, dbapi_base_err) and statement:
                msg = traceback.format_exception_only(
                    orig.__class__, orig)[-1].strip()
                return StatementError(
                    "%s (original cause: %s)" % (str(orig), msg),
                    statement, params, orig
                )

            glob = globals()
            for super_ in orig.__class__.__mro__:
                name = super_.__name__
                if name in glob and issubclass(glob[name], DBAPIError):
                    cls = glob[name]
                    break

        return cls(statement, params, orig, connection_invalidated) 
開發者ID:gltn,項目名稱:stdm,代碼行數:29,代碼來源:exc.py


注:本文中的sqlalchemy.exc.DontWrapMixin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。