Example #1
0
 def test_pycompat_defines_set(self):
     '''Test that calling pycompat24.add_builtin_set() adds set and frozenset to __builtin__
     '''
     import sets as py_sets
     sets.add_builtin_set()
     if self.set_val:
         tools.ok_(__builtin__.set == self.set_val)
         tools.ok_(__builtin__.frozenset == self.frozenset_val)
     else:
         tools.ok_(__builtin__.set == py_sets.Set)
         tools.ok_(__builtin__.frozenset == py_sets.ImmutableSet)
Example #2
0
 def test_pycompat_defines_set(self):
     '''Test that calling pycompat24.add_builtin_set() adds set and frozenset to __builtin__
     '''
     import sets as py_sets
     sets.add_builtin_set()
     if self.set_val:
         tools.ok_(__builtin__.set == self.set_val)
         tools.ok_(__builtin__.frozenset == self.frozenset_val)
     else:
         tools.ok_(__builtin__.set == py_sets.Set)
         tools.ok_(__builtin__.frozenset == py_sets.ImmutableSet)
#
'''**Deprecated** Use jsonfasprovider2 instead a it provides CSRF protection.

This plugin provides integration with the Fedora Account System using
:term:`JSON` calls.


.. moduleauthor:: Toshio Kuratomi <*****@*****.**>
.. moduleauthor:: Ricky Zhou <*****@*****.**>
'''

from cherrypy import response
from turbogears import config, identity
from kitchen.text.converters import to_bytes
from kitchen.pycompat24 import sets
sets.add_builtin_set()

from fedora.client import BaseClient, FedoraServiceError

from fedora import __version__

import crypt

import logging
log = logging.getLogger('turbogears.identity.safasprovider')


class JsonFasIdentity(BaseClient):
    '''
    Associate an identity with a person in the auth system.
    '''
Example #4
0
# -*- coding: utf-8 -*-
from nose import tools

import os
import types
import warnings
from kitchen.pycompat24.sets import add_builtin_set
add_builtin_set()

def logit(msg):
    log = open('/var/tmp/test.log', 'a')
    log.write('%s\n' % msg)
    log.close()

class NoAll(RuntimeError):
    pass

class FailedImport(RuntimeError):
    pass

class Test__all__(object):
    '''Test that every function in __all__ exists and that no public methods
    are missing from __all__
    '''
    known_private = set([('kitchen', 'collections', 'version_tuple_to_string'),
        ('kitchen.collections', 'strictdict', 'defaultdict'),
        ('kitchen', 'i18n', 'version_tuple_to_string'),
        ('kitchen', 'i18n', 'to_bytes'),
        ('kitchen', 'i18n', 'to_unicode'),
        ('kitchen', 'i18n', 'ENOENT'),
        ('kitchen', 'i18n', 'byte_string_valid_encoding'),
Example #5
0
    Deprecated :data:`~kitchen.text.converters.BYTE_EXCEPTION_CONVERTERS` as
    we've simplified :func:`~kitchen.text.converters.exception_to_unicode` and
    :func:`~kitchen.text.converters.exception_to_bytes` to make it unnecessary

'''
try:
    from base64 import b64encode, b64decode
except ImportError:
    from kitchen.pycompat24.base64 import b64encode, b64decode

import codecs
import warnings
import xml.sax.saxutils

from kitchen.pycompat24 import sets
sets.add_builtin_set()

from kitchen.text.exceptions import ControlCharError, XmlEncodeError
from kitchen.text.misc import guess_encoding, html_entities_unescape, \
        isbytestring, isunicodestring, process_control_chars

#: Aliases for the utf-8 codec
_UTF8_ALIASES = frozenset(('utf-8', 'UTF-8', 'utf8', 'UTF8', 'utf_8', 'UTF_8',
    'utf', 'UTF', 'u8', 'U8'))
#: Aliases for the latin-1 codec
_LATIN1_ALIASES = frozenset(('latin-1', 'LATIN-1', 'latin1', 'LATIN1',
    'latin', 'LATIN', 'l1', 'L1', 'cp819', 'CP819', '8859', 'iso8859-1',
    'ISO8859-1', 'iso-8859-1', 'ISO-8859-1'))

# EXCEPTION_CONVERTERS is defined below due to using to_unicode
Example #6
0
 def test_sets_dont_overwrite(self):
     '''Test that importing sets when there's already a set and frozenset defined does not overwrite
     '''
     sets.add_builtin_set()
     tools.ok_(__builtin__.set == self.set_val)
     tools.ok_(__builtin__.frozenset == self.frozenset_val)
# -*- coding: utf-8 -*-
from nose import tools

import os
import types
import warnings
from kitchen.pycompat24.sets import add_builtin_set
add_builtin_set()


def logit(msg):
    log = open('/var/tmp/test.log', 'a')
    log.write('%s\n' % msg)
    log.close()


class NoAll(RuntimeError):
    pass


class FailedImport(RuntimeError):
    pass


class Test__all__(object):
    '''Test that every function in __all__ exists and that no public methods
    are missing from __all__
    '''
    known_private = set([
        ('kitchen', 'collections', 'version_tuple_to_string'),
        ('kitchen.collections', 'strictdict', 'defaultdict'),
Example #8
0
 def test_sets_dont_overwrite(self):
     '''Test that importing sets when there's already a set and frozenset defined does not overwrite
     '''
     sets.add_builtin_set()
     tools.ok_(__builtin__.set == self.set_val)
     tools.ok_(__builtin__.frozenset == self.frozenset_val)