コード例 #1
0
ファイル: _core.py プロジェクト: nisavid/bedframe
"""Responses core"""

__copyright__ = "Copyright (C) 2014 Ivan D Vasin"
__docformat__ = "restructuredtext"

from spruce.collections import typedodict as _typedodict
from spruce.lang import enum as _enum


WebResponseFacetType = _enum('web response facet type',
                             ('return', 'children', 'auth_info', 'exc',
                              'proxy_redirect', 'resource_redirect',
                              'choice_redirect', 'response_redirect'))


OmniWebResponseFacetType = _enum('universal web response facet type',
                                 ('auth_info',))


class web_response_facettype_enum(_enum):
    def __init__(self, enum_displayname, values, **kwargs):
        values = tuple(values) + tuple(OmniWebResponseFacetType.enum_values)
        super(web_response_facettype_enum, self).__init__(enum_displayname,
                                                          values, **kwargs)


class WebResponse(object):

    """A web response

    This is a response to a web service request.
コード例 #2
0
ファイル: _services.py プロジェクト: nisavid/spruce-ldap
        if status == 'running':
            pid = _int(pid)
        else:
            pid = None

        self._pid = pid
        self._status = status

        if pid is not None:
            self._probe_status()

    def _start(self, fork=False):

        if fork:
            pid = _os.fork()
            if pid != 0:
                self._set_status('running', pid=pid)
                return pid

        self._start_nofork()
        self._set_status('running', pid=_os.getpid())

    @_abc.abstractmethod
    def _start_nofork(self):
        pass

    _SUFFIX_ORG_DN_RE = _re.compile(r'^dc=(?P<org>[^,]*),dc=(?P<tld>[^,]*)$')


ServiceStatus = _enum('LDAP service status', ('stopped', 'running', 'gone'))
コード例 #3
0
ファイル: _cors.py プロジェクト: nisavid/bedframe
                        self.client_preflight_cache_lifespan)))

    @classmethod
    def _property_displayname(cls, name):
        return name.replace('_', ' ')


class CorsAffordanceSetMap(_coll.HereditaryWebResourcePathMapping):
    """A cross-origin resource sharing affordances map

    This is a mapping from resource locations to specifications of their
    cross-origin request sharing affordances.  In addition to the basic
    mutable mapping functionality, it also

      * accepts path patterns in the form of strings or regular
        expressions and

      * ensures that that its items have valid types and values.

    .. seealso::
        :class:`~bedframe._collections.HereditaryResourcePathMapping`

    """
    def __init__(self, *args, **kwargs):
        super(CorsAffordanceSetMap, self).__init__(*args,
                                                   valuetype=CorsAffordanceSet,
                                                   **kwargs)


CorsRequestType = _enum('CORS request type', ('preflight', 'actual'))
コード例 #4
0
ファイル: _services.py プロジェクト: nisavid/bedframe
                              .format(status))

        if status == 'running':
            pid = _int(pid)
        else:
            pid = None

        self._pid = pid
        self._status = status

        if pid is not None:
            self._probe_status()

    def _start(self, fork=False):

        if fork:
            pid = _os.fork()
            if pid != 0:
                self._set_status('running', pid=pid)
                return pid

        self._start_nofork()
        self._set_status('running', pid=_os.getpid())

    @_abc.abstractmethod
    def _start_nofork(self):
        pass


WebServiceStatus = _enum('web service status', ('stopped', 'running', 'gone'))