Ejemplo n.º 1
0
	tprmm = tprm + '.' + macroname
	mymod = new.module(tprmm)
	sys.modules[tprmm] = mymod
	setattr(macros, macroname, mymod)
	dict = mymod.__dict__

	# Before we go on, I guess I should explain why I just did that.  Basically
	# it's a gross hack to get epydoc to work right, but the general idea is
	# that it will be a useful aid in debugging in _any_ app which expects
	# sys.modules to have the same globals as some function.  For example, it
	# would be useful if you were foolishly trying to pickle a wrapped function
	# directly from a class that had been hooked.

	exec code in dict, dict
	return dict[name]
macro = deprecated(Version("Twisted", 8, 2, 0))(macro)



def _determineClass(x):
	try:
		return x.__class__
	except:
		return type(x)



def _determineClassName(x):
	c = _determineClass(x)
	try:
		return c.__name__
Ejemplo n.º 2
0
    m.update(pszRealm)
    m.update(":")
    m.update(pszPassword)
    HA1 = m.digest()
    if pszAlg == "md5-sess":
        m = md5()
        m.update(HA1)
        m.update(":")
        m.update(pszNonce)
        m.update(":")
        m.update(pszCNonce)
        HA1 = m.digest()
    return HA1.encode('hex')


DigestCalcHA1 = deprecated(Version("Twisted", 9, 0, 0))(DigestCalcHA1)


def DigestCalcResponse(
    HA1,
    pszNonce,
    pszNonceCount,
    pszCNonce,
    pszQop,
    pszMethod,
    pszDigestUri,
    pszHEntity,
):
    m = md5()
    m.update(pszMethod)
    m.update(":")
Ejemplo n.º 3
0
				'max': self.max,
				'noisy': self.noisy,
				'reconnect': self.reconnect,
				'good_sql': self.good_sql,
				'connargs': self.connargs,
				'connkw': self.connkw}

	def __setstate__(self, state):
		self.__dict__ = state
		self.__init__(self.dbapiName, *self.connargs, **self.connkw)



# Common deprecation decorator used for all deprecations.
_unreleasedVersion = Version("Twisted", 8, 0, 0)
_unreleasedDeprecation = deprecated(_unreleasedVersion)



def _safe(text):
	"""
	Something really stupid that replaces quotes with escaped quotes.
	"""
	return text.replace("'", "''").replace("\\", "\\\\")



def safe(text):
	"""
	Make a string safe to include in an SQL statement.
	"""
Ejemplo n.º 4
0
# -*- test-case-name: lib.twisted.test.test_enterprise -*-
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.

import warnings, types

from lib.twisted.python.versions import Version, getVersionString
from lib.twisted.python.deprecate import deprecated
from lib.twisted.enterprise.adbapi import _safe

# Common deprecation decorator used for all deprecations.
_deprecatedVersion = Version("Twisted", 8, 0, 0)
_releasedDeprecation = deprecated(_deprecatedVersion)

warnings.warn("lib.twisted.enterprise.util is deprecated since %s." %
              (getVersionString(_deprecatedVersion), ),
              category=DeprecationWarning)

NOQUOTE = 1
USEQUOTE = 2

dbTypeMap = {
    "bigint": NOQUOTE,
    "bool": USEQUOTE,
    "boolean": USEQUOTE,
    "bytea": USEQUOTE,
    "date": USEQUOTE,
    "int2": NOQUOTE,
    "int4": NOQUOTE,
    "int8": NOQUOTE,
    "int": NOQUOTE,
Ejemplo n.º 5
0
    sys.modules[tprmm] = mymod
    setattr(macros, macroname, mymod)
    dict = mymod.__dict__

    # Before we go on, I guess I should explain why I just did that.  Basically
    # it's a gross hack to get epydoc to work right, but the general idea is
    # that it will be a useful aid in debugging in _any_ app which expects
    # sys.modules to have the same globals as some function.  For example, it
    # would be useful if you were foolishly trying to pickle a wrapped function
    # directly from a class that had been hooked.

    exec code in dict, dict
    return dict[name]


macro = deprecated(Version("Twisted", 8, 2, 0))(macro)


def _determineClass(x):
    try:
        return x.__class__
    except:
        return type(x)


def _determineClassName(x):
    c = _determineClass(x)
    try:
        return c.__name__
    except:
        try: