Exemple #1
0
    pass


# Can't declare forward refs, so fix up afterwards:

IIBucketPy._mapping_type = IIBucketPy._bucket_type = IIBucketPy
IIBucketPy._set_type = IISetPy

IISetPy._mapping_type = IIBucketPy
IISetPy._set_type = IISetPy._bucket_type = IISetPy

IIBTreePy._mapping_type = IIBTreePy._bucket_type = IIBucketPy
IIBTreePy._set_type = IISetPy

IITreeSetPy._mapping_type = IIBucketPy
IITreeSetPy._set_type = IITreeSetPy._bucket_type = IISetPy


differencePy = _set_operation(_difference, IISetPy)
unionPy = _set_operation(_union, IISetPy)
intersectionPy = _set_operation(_intersection, IISetPy)
multiunionPy = _set_operation(_multiunion, IISetPy)
weightedUnionPy = _set_operation(_weightedUnion, IISetPy)
weightedIntersectionPy = _set_operation(_weightedIntersection, IISetPy)

import_c_extension(globals())

_fix_pickle(globals(), __name__)

moduleProvides(IIntegerIntegerBTreeModule)
Exemple #2
0
try:
    from _LFBTree import LFBucket
    from _LFBTree import LFSet
    from _LFBTree import LFBTree
    from _LFBTree import LFTreeSet
    from _LFBTree import difference
    from _LFBTree import union
    from _LFBTree import intersection
    from _LFBTree import multiunion
    from _OIBTree import weightedUnion
    from _OIBTree import weightedIntersection
except ImportError: #pragma NO COVER
    LFBucket = LFBucketPy
    LFSet = LFSetPy
    LFBTree = LFBTreePy
    LFTreeSet = LFTreeSetPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
    multiunion = multiunionPy
    weightedUnion = weightedUnionPy
    weightedIntersection = weightedIntersectionPy

Bucket = LFBucket
Set = LFSet
BTree = LFBTree
TreeSet = LFTreeSet

moduleProvides(IIntegerFloatBTreeModule)
##############################################################################
#
# Copyright (c) 2006-2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Grok
"""
from grokcore.component import *
from grokcore.security import *
from grokcore.view import *

from grokcore.traverser.directive import traversable
from grokcore.traverser.components import Traverser

from grokcore.traverser.interfaces import IGrokTraverser
from zope.interface import moduleProvides
moduleProvides(IGrokTraverser)
__all__ = list(IGrokTraverser)
Exemple #4
0
from ZODB.POSException import TransactionTooLargeError

from ..interfaces import IDBDriver, IDBDriverOptions

from .._abstract_drivers import _standard_exceptions

from relstorage._compat import intern

logger = __import__('logging').getLogger(__name__)

database_type = 'mysql'
suggested_drivers = []
driver_map = {}
preferred_driver_name = None

moduleProvides(IDBDriverOptions)

try:
    import MySQLdb
except ImportError:
    pass
else:

    @implementer(IDBDriver)
    class MySQLdbDriver(object):
        __name__ = 'MySQLdb'
        disconnected_exceptions, close_exceptions, lock_exceptions = _standard_exceptions(MySQLdb)
        use_replica_exceptions = (MySQLdb.OperationalError,)
        Binary = staticmethod(MySQLdb.Binary)
        connect = staticmethod(MySQLdb.connect)
    del MySQLdb
Exemple #5
0
from zope.interface import moduleProvides

# Twisted imports
from twisted.python.compat import nativeString
from twisted.python.runtime import platform
from twisted.python.filepath import FilePath
from twisted.internet import error, defer, interfaces, protocol
from twisted.python import log, failure
from twisted.names import (
    dns, common, resolve, cache, root, hosts as hostsModule)
from twisted.internet.abstract import isIPv6Address



moduleProvides(interfaces.IResolver)



class Resolver(common.ResolverBase):
    """
    @ivar _waiting: A C{dict} mapping tuple keys of query name/type/class to
        Deferreds which will be called back with the result of those queries.
        This is used to avoid issuing the same query more than once in
        parallel.  This is more efficient on the network and helps avoid a
        "birthday paradox" attack by keeping the number of outstanding requests
        for a particular query fixed at one instead of allowing the attacker to
        raise it to an arbitrary number.

    @ivar _reactor: A provider of L{IReactorTCP}, L{IReactorUDP}, and
        L{IReactorTime} which will be used to set up network resources and
         return obj.__subject__
     else:
         return obj

def removeAllProxies(obj):
    return getProxiedObject(obj)


def sameProxiedObjects(obj1,obj2):
    if getProxiedObject(obj1) == getProxiedObject(obj2):
        return True
    else:
        return False    
        
        
    
    
    
    
moduleProvides(IProxyIntrospection)
__all__ = tuple(IProxyIntrospection)

def ProxyIterator(p):
    yield p
    while isProxy(p):
        p = getProxiedObject(p)
        yield p

def non_overridable(func):
    return property(lambda self: func.__get__(self))
Exemple #7
0
import sys
import os

from zope.interface import moduleProvides
from zope.interface import implementer

from ..interfaces import IDBDriver, IDBDriverOptions
from .._abstract_drivers import _standard_exceptions

database_type = 'postgresql'
suggested_drivers = []
driver_map = {}
preferred_driver_name = None

moduleProvides(IDBDriverOptions)


def _create_connection(mod):
    class Psycopg2Connection(mod.extensions.connection):
        # The replica attribute holds the name of the replica this
        # connection is bound to.
        # pylint:disable=slots-on-old-class
        __slots__ = ('replica', )

    return Psycopg2Connection


try:
    import psycopg2
except ImportError:
Exemple #8
0
#
##############################################################################
"""
Convenience functions for traversing the object tree.

This module provides :class:`zope.traversing.interfaces.ITraversalAPI`
"""
import six
from zope.interface import moduleProvides
from zope.location.interfaces import ILocationInfo, IRoot
from zope.traversing.interfaces import ITraversalAPI, ITraverser

# The authoritative documentation for these functions
# is in this interface. Later, we replace all our docstrings
# with those defined in the interface.
moduleProvides(ITraversalAPI)
__all__ = tuple(ITraversalAPI)

_marker = object()


def joinPath(path, *args):
    """
    Join the given relative paths to the given path.

    See `ITraversalAPI` for details.
    """

    if not args:
        # Concatenating u'' is much quicker than unicode(path)
        return u'' + path
Exemple #9
0
from zope.component.globalregistry import provideSubscriptionAdapter
from zope.component.globalregistry import provideUtility

from zope.component._api import adapter_hook
from zope.component._api import createObject
from zope.component._api import getAdapter
from zope.component._api import getAdapterInContext
from zope.component._api import getAdapters
from zope.component._api import getAllUtilitiesRegisteredFor
from zope.component._api import getFactoriesFor
from zope.component._api import getFactoryInterfaces
from zope.component._api import getMultiAdapter
from zope.component._api import getSiteManager
from zope.component._api import getUtilitiesFor
from zope.component._api import getUtility
from zope.component._api import getNextUtility
from zope.component._api import handle
from zope.component._api import queryAdapter
from zope.component._api import queryAdapterInContext
from zope.component._api import queryMultiAdapter
from zope.component._api import queryUtility
from zope.component._api import queryNextUtility
from zope.component._api import subscribers

from zope.component._declaration import adaptedBy
from zope.component._declaration import adapter
from zope.component._declaration import adapts

moduleProvides(IComponentArchitecture, IComponentRegistrationConvenience)
__all__ = tuple(IComponentArchitecture)
Exemple #10
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Lang C: Support for the C language

Provides everything needed to output files that support the
binary format in the C programming language.
"""

from os.path import basename
from zope.interface import moduleProvides
from structspec.common import writeOut, writeOutBlock, giveUp,\
    getJsonPointer, schemaVal, typeSizes
from structspec.interfaces import ILanguage

moduleProvides(ILanguage)

name = "C"
filenameExtension = ('h', 'c')
resolveJsonPointer = getJsonPointer()


def outputC(specification, options, hFile, cFile):
    """
    Outputs C header file.

    Given the specification construct a valid C header
    file that describes all the binary packets.

    Args:
        specification (dict): The specification object.
from zope.interface.interfaces import ObjectEvent
from zope.interface import implementer, moduleProvides
from zope.event import notify

from zope.lifecycleevent.interfaces import IZopeLifecycleEvent
from zope.lifecycleevent.interfaces import IObjectCreatedEvent
from zope.lifecycleevent.interfaces import IObjectModifiedEvent
from zope.lifecycleevent.interfaces import IObjectCopiedEvent
from zope.lifecycleevent.interfaces import IObjectMovedEvent
from zope.lifecycleevent.interfaces import IObjectAddedEvent
from zope.lifecycleevent.interfaces import IObjectRemovedEvent
from zope.lifecycleevent.interfaces import IAttributes
from zope.lifecycleevent.interfaces import ISequence


moduleProvides(IZopeLifecycleEvent)

@implementer(IObjectCreatedEvent)
class ObjectCreatedEvent(ObjectEvent):
    """An object has been created"""


def created(object):
    "See :meth:`.IZopeLifecycleEvent.created`"
    notify(ObjectCreatedEvent(object))


@implementer(IAttributes)
class Attributes(object):
    """Describes modified attributes of an interface."""
Exemple #12
0
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Dummy Module

$Id$
"""
from zope.interface import moduleProvides
from zope.interface.tests.ifoo import IFoo
from zope.interface import moduleProvides

moduleProvides(IFoo)

def bar(baz):
    pass
Exemple #13
0
    global _model_cache
    path = utils.relativeToCallingPackage(filename, _frame)
    if reload or path not in _model_cache:
        parsed_model = parser.parse(path, policy=policy)
        for schema in parsed_model.schemata.values():
            schema.setTaggedValue(FILENAME_KEY, path)
        _model_cache[path] = parsed_model
    return _model_cache[path]


def loadString(model, policy=u""):
    return parser.parse(StringIO(model), policy=policy)


def serializeSchema(schema, name=u""):
    return serializeModel(model.Model({name: schema}))


def serializeModel(model):
    return serializer.serialize(model)


moduleProvides(IXMLToSchema)

__all__ = (
    'xmlSchema',
    'loadFile',
    'loadString',
    'serializeSchema',
    'serializeModel',
)
Exemple #14
0
##############################################################################
#
# Copyright (c) 2006-2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Grokcore.annotation
"""

from grokcore.component import *

from grokcore.annotation.components import Annotation, Model

# BBB These two functions are meant for test fixtures and should be
# imported from grok.testing, not from grok.
from grokcore.annotation.testing import grok

# Our __init__ provides the grok API directly so using 'import grok' is enough.
from grokcore.annotation.interfaces import IGrokcoreAnnotationAPI
from zope.interface import moduleProvides
moduleProvides(IGrokcoreAnnotationAPI)
__all__ = list(IGrokcoreAnnotationAPI)
$Id: sa2zs.py 364 2009-04-02 11:29:46Z mborch $
"""

from zope import interface, schema, component
from zope.interface.interface import InterfaceClass
from zope.schema.interfaces import ValidationError

from sqlalchemy.util import OrderedDict
from sqlalchemy import types as rt
import sqlalchemy as rdb

from interfaces import ITableSchema, TransmutationException, IAlchemistTransmutation, \
     IModelDescriptor, IIModelInterface

interface.moduleProvides( IAlchemistTransmutation )

class TableAnnotation( object ):
    """
    Annotations for Table objects, to annotate as needed, the notion
    is that the annotation keys correspond to column, and values correspond
    to application specific column metadata.
    """

    _marker = object()
    schema_invariants = ()
    
    def __init__(self, table_name, columns=(), properties=(), schema_order=(), listing_columns=(), order_by=()):
        self.table_name = table_name
        self._options = {}
        self._annot = OrderedDict()
Exemple #16
0
# !/usr/bin/env python

import logging
from zope.interface import moduleProvides

from exchangelib.interfaces import IDataAPI
from exchangelib.utils import get_json
from exchangelib import schemas, simpleschema

log = logging.getLogger(__name__)
moduleProvides(IDataAPI)

__all__ = ['ticker', 'orderbook', 'trades', 'pair_info']

# todo pairs/currencies
PAIRS = ['btcusd']
DATA_API_URL = "https://btc-e.com/api/3/"

# API v3
# todo support multi-pair queries
# todo add options
# todo pull out the pair key e.g. btc_usd


# todo add basis_volume to dec conversion? float so done auto for now
@simpleschema.returns(schemas.Ticker)
def ticker(pair='btcusd'):
    # api fails with code 200 and     {u'error': u'Invalid method', u'success': 0}
    def process(data):
        new = data[_convert_pair(pair)]
        return simpleschema.remap(
        if self._updated is False:
            self.updateActions()
            self.updateWidgets()
            self._updated = True

    def __call__(self, *args, **kwargs):
        try:
            self.update(*args, **kwargs)
            self.updateForm()
            result = self.render(*args, **kwargs)
            return self.make_response(result, *args, **kwargs)
        except HTTPRedirect as exc:
            return redirect_exception_response(self.responseFactory, exc)


@implementer(interfaces.ISimpleForm)
class Form(FormCanvas, StandaloneForm):
    """A full simple standalone form.
    """
    def __init__(self, context, request, **kwargs):
        content = kwargs.get('content', context)
        FormCanvas.__init__(self, context, request, content=content)

    def update(self, *args, **kwargs):
        FormCanvas.update(self, *args, **kwargs)
        StandaloneForm.update(self, *args, **kwargs)


moduleProvides(interfaces.IFormComponents)
__all__ = list(interfaces.IFormComponents)
Exemple #18
0
##############################################################################
#
# Copyright (c) 2006-2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

from grokcore.component import *
from grokcore.security import *
from grokcore.view import *
from grokcore.rest.interfaces import IREST
from grokcore.rest.interfaces import IRESTLayer
from grokcore.rest.interfaces import IRESTSkinType
from grokcore.rest.components import REST
from grokcore.rest.directive import restskin
from zope.interface import moduleProvides
moduleProvides(IREST)
__all__ = list(IREST)
    _model = loadFile(filename, policy=policy, _frame=_frame + 1)
    return _model.schemata[schema]


def loadFile(filename, reload=False, policy=u"", _frame=2):
    global _model_cache
    path = utils.relativeToCallingPackage(filename, _frame)
    if reload or path not in _model_cache:
        parsed_model = parser.parse(path, policy=policy)
        for schema in parsed_model.schemata.values():
            schema.setTaggedValue(FILENAME_KEY, path)
        _model_cache[path] = parsed_model
    return _model_cache[path]


def loadString(model, policy=u""):
    return parser.parse(StringIO(model), policy=policy)


def serializeSchema(schema, name=u""):
    return serializeModel(model.Model({name: schema}))


def serializeModel(model):
    return serializer.serialize(model)


moduleProvides(IXMLToSchema)

__all__ = ('xmlSchema', 'loadFile', 'loadString', 'serializeSchema', 'serializeModel')
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Processes

$Id$
"""

from zope import component, interface
from zope.wfmc import interfaces

interface.moduleProvides(interfaces.IIntegration)


def createParticipant(activity, process_definition_identifier, performer):
    participant = component.queryAdapter(
        activity, interfaces.IParticipant,
        process_definition_identifier + '.' + performer)

    if participant is None:
        participant = component.getAdapter(activity, interfaces.IParticipant,
                                           '.' + performer)

    return participant


def createWorkItem(participant, process_definition_identifier, application):
Exemple #21
0
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" Dummy Module
"""
from zope.interface import moduleProvides
from zope.interface.tests.idummy import IDummyModule

moduleProvides(IDummyModule)

def bar(baz):
    # Note:  no 'self', because the module provides the interface directly.
    raise NotImplementedError()
Exemple #22
0
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
from zope.lifecycleevent import Attributes
from zope.browserpage import namedtemplate

from zope.formlib._compat import basestring, unicode
from zope.formlib.interfaces import IWidgetInputErrorView
from zope.formlib.interfaces import IInputWidget, IDisplayWidget
from zope.formlib.interfaces import WidgetsError, MissingInputError
from zope.formlib.interfaces import InputErrors, WidgetInputError
from zope.formlib.interfaces import InvalidFormError, InvalidCSRFTokenError

from zope.formlib import interfaces
from zope.i18nmessageid import MessageFactory
_ = MessageFactory("zope")

interface.moduleProvides(interfaces.IFormAPI)


def expandPrefix(prefix):
    """Expand prefix string by adding a trailing period if needed.

    expandPrefix(p) should be used instead of p+'.' in most contexts.
    """
    if prefix and not prefix.endswith('.'):
        return prefix + '.'
    return prefix


@interface.implementer(interfaces.IFormField)
class FormField(object):
    """Implementation of `zope.formlib.interfaces.IFormField`. """
Exemple #23
0
weightedIntersectionPy = _set_operation(_weightedIntersection, OISetPy)

try:
    from _OIBTree import OIBucket
    from _OIBTree import OISet
    from _OIBTree import OIBTree
    from _OIBTree import OITreeSet
    from _OIBTree import difference
    from _OIBTree import union
    from _OIBTree import intersection
    from _OIBTree import weightedUnion
    from _OIBTree import weightedIntersection
except ImportError: #pragma NO COVER
    OIBucket = OIBucketPy
    OISet = OISetPy
    OIBTree = OIBTreePy
    OITreeSet = OITreeSetPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
    weightedUnion = weightedUnionPy
    weightedIntersection = weightedIntersectionPy


Bucket = OIBucket
Set = OISet
BTree = OIBTree
TreeSet = OITreeSet

moduleProvides(IObjectIntegerBTreeModule)
Exemple #24
0
##############################################################################
#
# Copyright (c) 2006-2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

from grokcore.component import *
from grokcore.security import *
from grokcore.view import *


from grokcore.json.components import JSON

from grokcore.json.interfaces import IGrokcoreJSONAPI
from zope.interface import moduleProvides
moduleProvides(IGrokcoreJSONAPI)
__all__ = list(IGrokcoreJSONAPI)
Exemple #25
0
# !/usr/bin/env python

import logging
import datetime
import pytz
import calendar
from zope.interface import moduleProvides

from exchangelib.interfaces import IDataAPI
from exchangelib.utils import get_json
from exchangelib import schemas, simpleschema

log = logging.getLogger(__name__)
moduleProvides(IDataAPI)

__all__ = ["ticker", "orderbook", "trades", "candlestick", "detail"]

PAIRS = ["btccny", "ltccny"]
DATA_API_URL = "https://market.huobi.com/staticmarket/"

# Example failure:
# Failure: twisted.internet.error.TimeoutError: User timeout caused connection failure.


@simpleschema.returns(schemas.Ticker)
def ticker(pair="btccny"):
    def process(data):
        data.update(data["ticker"])
        data.pop("ticker")
        return data
Exemple #26
0
    IObjectRemovedEvent,
    IContainerModifiedEvent)
from zope.container.contained import (
    ObjectAddedEvent,
    ObjectMovedEvent,
    ObjectRemovedEvent,
    ContainerModifiedEvent)

from grok.events import ApplicationInitializedEvent
from grok.components import Application
from grok.components import View, Form, AddForm, EditForm, DisplayForm
from grok.components import XMLRPC, REST, JSON
from grok.components import Traverser
from grok.components import Indexes
from grok.components import Role
from grok.interfaces import IRESTSkinType, IRESTLayer
from grok.interfaces import IApplicationInitializedEvent

from grok.directive import (
    permissions, site, restskin, traversable)

# BBB These two functions are meant for test fixtures and should be
# imported from grok.testing, not from grok.
from grok.testing import grok, grok_component

# Our __init__ provides the grok API directly so using 'import grok' is enough.
from grok.interfaces import IGrokAPI
from zope.interface import moduleProvides
moduleProvides(IGrokAPI)
__all__ = list(IGrokAPI)
Exemple #27
0
from guillotina.component._api import subscribers
from guillotina.component._declaration import adaptedBy
from guillotina.component._declaration import adapter
from guillotina.component._declaration import adapts
from guillotina.component.globalregistry import get_global_components
from guillotina.component.globalregistry import provide_adapter
from guillotina.component.globalregistry import provide_handler
from guillotina.component.globalregistry import provide_subscription_adapter
from guillotina.component.globalregistry import provide_utility
from guillotina.component.interfaces import ComponentLookupError
from guillotina.component.interfaces import IComponentArchitecture
from guillotina.component.interfaces import IComponentLookup
from guillotina.component.interfaces import IComponentRegistrationConvenience
from guillotina.component.interfaces import IFactory
from zope.interface import moduleProvides


# b/w compat imports. Will be removed in 3.0
getMultiAdapter = get_multi_adapter
queryMultiAdapter = query_multi_adapter
getAdapter = get_adapter
queryAdapter = query_adapter
getUtility = get_utility
queryUtility = query_utility
getUtilitiesFor = get_utilities_for
getAdapters = get_adapters


moduleProvides(IComponentArchitecture, IComponentRegistrationConvenience)
__all__ = tuple(IComponentArchitecture)  # type: ignore
Exemple #28
0
except ImportError:  #pragma NO COVER w/ C extensions
    LLBucket = LLBucketPy
    LLSet = LLSetPy
    LLBTree = LLBTreePy
    LLTreeSet = LLTreeSetPy
    LLTreeIterator = LLTreeIteratorPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
    multiunion = multiunionPy
    weightedUnion = weightedUnionPy
    weightedIntersection = weightedIntersectionPy
else:  #pragma NO COVER w/o C extensions
    from ._LLBTree import LLSet
    from ._LLBTree import LLBTree
    from ._LLBTree import LLTreeSet
    from ._LLBTree import LLTreeIterator
    from ._LLBTree import difference
    from ._LLBTree import union
    from ._LLBTree import intersection
    from ._LLBTree import multiunion
    from ._LLBTree import weightedUnion
    from ._LLBTree import weightedIntersection

Bucket = LLBucket
Set = LLSet
BTree = LLBTree
TreeSet = LLTreeSet

moduleProvides(IIntegerIntegerBTreeModule)
Exemple #29
0
differencePy = _set_operation(_difference, OOSetPy)
unionPy = _set_operation(_union, OOSetPy)
intersectionPy = _set_operation(_intersection, OOSetPy)

try:
    from ._OOBTree import OOBucket
except ImportError as e:  # pragma NO COVER w/ C extensions
    OOBucket = OOBucketPy
    OOSet = OOSetPy
    OOBTree = OOBTreePy
    OOTreeSet = OOTreeSetPy
    OOTreeIterator = OOTreeIteratorPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
else:  # pragma NO COVER w/o C extensions
    from ._OOBTree import OOSet
    from ._OOBTree import OOBTree
    from ._OOBTree import OOTreeSet
    from ._OOBTree import OOTreeIterator
    from ._OOBTree import difference
    from ._OOBTree import union
    from ._OOBTree import intersection

Bucket = OOBucket
Set = OOSet
BTree = OOBTree
TreeSet = OOTreeSet

moduleProvides(IObjectObjectBTreeModule)
Exemple #30
0
##############################################################################
#
# Copyright (c) 2006-2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################

from grokcore.component import *
from grokcore.security import *
from grokcore.view import *

from grokcore.json.components import JSON

from grokcore.json.interfaces import IGrokcoreJSONAPI
from zope.interface import moduleProvides
moduleProvides(IGrokcoreJSONAPI)
__all__ = list(IGrokcoreJSONAPI)
Exemple #31
0
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""More convenience functions for dealing with proxies.
"""
from zope.interface import moduleProvides
from zope.proxy.interfaces import IProxyIntrospection
from zope.proxy._zope_proxy_proxy import *
from zope.proxy._zope_proxy_proxy import _CAPI

moduleProvides(IProxyIntrospection)
__all__ = tuple(IProxyIntrospection)


def ProxyIterator(p):
    yield p
    while isProxy(p):
        p = getProxiedObject(p)
        yield p


def non_overridable(func):
    return property(lambda self: func.__get__(self))
Exemple #32
0
#
##############################################################################
"""Collection of many common api functions

Makes imports easier

$Id: __init__.py 39058 2005-10-11 18:31:25Z philikon $
"""
from interfaces import IZAPI
from zope.interface import moduleProvides

from zope.security.proxy import isinstance

from zope.app.interface import queryType

moduleProvides(IZAPI)
__all__ = tuple(IZAPI)

from zope.component import *

from zope.app.publisher.browser import getDefaultViewName
from zope.app.publisher.browser import queryDefaultViewName
from zope.app.traversing.api import *
from zope.app.traversing.browser.absoluteurl import absoluteURL
from zope.app.exception.interfaces import UserError

name = getName

def principals():
    from zope.app.security.interfaces import IAuthentication
    return getUtility(IAuthentication)
Exemple #33
0
try:
    from _LFBTree import LFBucket
    from _LFBTree import LFSet
    from _LFBTree import LFBTree
    from _LFBTree import LFTreeSet
    from _LFBTree import difference
    from _LFBTree import union
    from _LFBTree import intersection
    from _LFBTree import multiunion
    from _OIBTree import weightedUnion
    from _OIBTree import weightedIntersection
except ImportError:  #pragma NO COVER
    LFBucket = LFBucketPy
    LFSet = LFSetPy
    LFBTree = LFBTreePy
    LFTreeSet = LFTreeSetPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
    multiunion = multiunionPy
    weightedUnion = weightedUnionPy
    weightedIntersection = weightedIntersectionPy

Bucket = LFBucket
Set = LFSet
BTree = LFBTree
TreeSet = LFTreeSet

moduleProvides(IIntegerFloatBTreeModule)
Exemple #34
0
    IBSet = IBSetPy
    IBBTree = IBBTreePy
    IBTreeSet = IBTreeSetPy
    IBTreeIterator = IBTreeIteratorPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
    multiunion = multiunionPy
    weightedUnion = weightedUnionPy
    weightedIntersection = weightedIntersectionPy
else: #pragma NO COVER w/o C extensions
    from ._IBBTree import IBSet
    from ._IBBTree import IBBTree
    from ._IBBTree import IBTreeSet
    from ._IBBTree import IBTreeIterator
    from ._IBBTree import difference
    from ._IBBTree import union
    from ._IBBTree import intersection
    from ._IBBTree import multiunion
    from ._IBBTree import weightedUnion
    from ._IBBTree import weightedIntersection

Bucket = IBBucket
Set = IBSet
BTree = IBBTree
TreeSet = IBTreeSet

_fix_pickle(globals(), __name__)

moduleProvides(IIntegerByteBTreeModule)
Exemple #35
0
from zope.schema.interfaces import ValidationError
from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
from zope.lifecycleevent import Attributes
from zope.browserpage import namedtemplate

from zope.formlib.interfaces import IWidgetInputErrorView
from zope.formlib.interfaces import IInputWidget, IDisplayWidget
from zope.formlib.interfaces import WidgetsError, MissingInputError
from zope.formlib.interfaces import InputErrors, WidgetInputError

from zope.formlib import interfaces
from zope.i18nmessageid import MessageFactory
_ = MessageFactory("zope")


interface.moduleProvides(interfaces.IFormAPI)


def expandPrefix(prefix):
    """Expand prefix string by adding a trailing period if needed.

    expandPrefix(p) should be used instead of p+'.' in most contexts.
    """
    if prefix and not prefix.endswith('.'):
        return prefix + '.'
    return prefix

@interface.implementer(interfaces.IFormField)
class FormField:

    def __init__(self, field, name=None, prefix='',
Exemple #36
0
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Convenience functions for traversing the object tree.
"""
from zope.interface import moduleProvides
from zope.location.interfaces import ILocationInfo, IRoot, LocationError
from zope.traversing.interfaces import ITraversalAPI, ITraverser


moduleProvides(ITraversalAPI)
__all__ = tuple(ITraversalAPI)

_marker = object()

def joinPath(path, *args):
    """Join the given relative paths to the given path.

    Returns a unicode path.

    The path should be well-formed, and not end in a '/' unless it is
    the root path. It can be either a string (ascii only) or unicode.
    The positional arguments are relative paths to be added to the
    path as new path segments.  The path may be absolute or relative.

    A segment may not start with a '/' because that would be confused
Exemple #37
0
    """
    if '_outerWidget' in child.__dict__:
        logger.debug('parenting %r <- %r' % (parent, child))
        if '_innerWidget' in parent.__dict__:
            if child._outerWidget.parent is not None:
                raise ValueError, 'child %r is already parented to a %r' % \
                      (child, child._outerWidget.parent)
            logger.debug('concreted')
            try:
                packer = parent._innerWidget.pack_start
            except AttributeError:
                # maybe it's a Window?
                parent._innerWidget.add(child._outerWidget)
                parent._innerWidget.set_border_width(child.border)
            else:
                packer(child._outerWidget, child.expand, child.fill,
                       child.border)
        else:
            if parent.parent is None:
                logger.debug('postponed')
                try:
                    parent._childrenToParent.append(child)
                except AttributeError:
                    parent._childrenToParent = [child]
            else:
                logger.debug('forwarded to %r' % parent.parent)
                parent.parent._concreteParenter(child)


moduleProvides(ISkin)
Exemple #38
0
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module that declares an interface

$Id$
"""
from zope.interface import Interface, moduleProvides


class I1(Interface):
    pass


class I2(Interface):
    pass


moduleProvides(I1, I2)
Exemple #39
0
__all__ = [
    'system_user',
    'getSecurityPolicy',
    'setSecurityPolicy',
    'queryInteraction',
    'getInteraction',
    'ExistingInteraction',
    'newInteraction',
    'endInteraction',
    'restoreInteraction',
    'checkPermission',
]

_defaultPolicy = ParanoidSecurityPolicy

moduleProvides(ISecurityManagement, IInteractionManagement)

#
#   ISecurityManagement implementation
#


def getSecurityPolicy():
    """Get the system default security policy."""
    return _defaultPolicy


def setSecurityPolicy(aSecurityPolicy):
    """Set the system default security policy, and return the previous
    value.
Exemple #40
0
##############################################################################
#
# Copyright (c) 2006-2009 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Grokcore.annotation
"""

from grokcore.component import *

from grokcore.annotation.components import Annotation, Model

# BBB These two functions are meant for test fixtures and should be
# imported from grok.testing, not from grok.
from grokcore.annotation.testing import grok

# Our __init__ provides the grok API directly so using 'import grok' is enough.
from grokcore.annotation.interfaces import IGrokcoreAnnotationAPI
from zope.interface import moduleProvides
moduleProvides(IGrokcoreAnnotationAPI)
__all__ = list(IGrokcoreAnnotationAPI)
Exemple #41
0
from ConfigParser import SafeConfigParser
import json
import os

from zope.interface import moduleProvides

from carapace.config import Config, Configurator, main, ssh
from carapace.sdk import interfaces

from prakasha import meta


moduleProvides(interfaces.IConfig)


# Main
main.config.datadir = os.path.expanduser("~/.%s" % meta.library_name)
main.config.localfile = "config.ini"
main.config.installedfile = os.path.join(main.config.datadir, main.config.localfile)

# Internal SSH Server
ssh.servicename = "SSH Server"
ssh.port = 6622
ssh.keydir = ".prakasha-ssh"
ssh.banner = """:
: Welcome to
:
:    .;@@
:      .@@@
:        @@@                                 +'
:        '@@;                                +@@`
Exemple #42
0
from ConfigParser import SafeConfigParser
import json
import os

from zope.interface import moduleProvides

from dreamssh.config import Config, Configurator, main, ssh
from dreamssh.sdk import interfaces


moduleProvides(interfaces.IConfig)


# Main
main.config.userdir = os.path.expanduser("~/.prakasha-bot")
main.config.userfile = "%s/%s" % (main.config.userdir, main.config.localfile)

# Internal SSH Server
ssh.servicename = "SSH Server"
ssh.port = 6622
ssh.keydir = ".prakasha-ssh"
ssh.banner = """:
: Welcome to
:
:    .;@@
:      .@@@
:        @@@                                 +'
:        '@@;                                +@@`
:      ::,@@@::::::::::::::::::::::::::::::::#@@::::::::,
:      @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#
:         @@@                       @@@      +@@`
Exemple #43
0
from BTrees.Interfaces import IIntegerIntegerBTreeModule as IBTreeInterface
import BTrees.IIBTree as TreeModule
from zope.interface import moduleProvides

max_internal_size = 2850
max_leaf_size = 1425


class BTree(TreeModule.BTree):
    max_internal_size = max_internal_size
    max_leaf_size = max_leaf_size


class TreeSet(TreeModule.TreeSet):
    max_internal_size = max_internal_size
    max_leaf_size = max_leaf_size


Set = TreeModule.Set
Bucket = TreeModule.Bucket
difference = TreeModule.difference
union = TreeModule.union
intersection = TreeModule.intersection
multiunion = TreeModule.multiunion
weightedUnion = TreeModule.weightedUnion
weightedIntersection = TreeModule.weightedIntersection

moduleProvides(IBTreeInterface)
Exemple #44
0
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Test module that declares an interface

$Id: m1.py 70826 2006-10-20 03:41:16Z baijum $
"""
from zope.interface import Interface, moduleProvides

class I1(Interface): pass
class I2(Interface): pass

moduleProvides(I1, I2)
Exemple #45
0
class Footer(ViewletManager):
    context(Interface)
    request(IHTTPRequest)


class AboveBody(ViewletManager):
    context(Interface)
    request(IHTTPRequest)


class BelowBody(ViewletManager):
    context(Interface)
    request(IHTTPRequest)


class Master(Layout):
    context(Interface)
    request(IHTTPRequest)

    template = get_template('master.pt')

    def render(self, view=None, *args, **kwargs):
        if view is not None:
            resources = Resources(self.context, self.request, view)
            resources()
        return Layout.render(self, view=view, *args, **kwargs)


moduleProvides(API.IGlobalUI)
__all__ = list(API.IGlobalUI)
$Id: sa2zs.py 364 2009-04-02 11:29:46Z mborch $
"""

from zope import interface, schema, component
from zope.interface.interface import InterfaceClass
from zope.schema.interfaces import ValidationError

from sqlalchemy.util import OrderedDict
from sqlalchemy import types as rt
import sqlalchemy as rdb

from interfaces import ITableSchema, TransmutationException, IAlchemistTransmutation, \
     IModelDescriptor, IIModelInterface

interface.moduleProvides(IAlchemistTransmutation)


class TableAnnotation(object):
    """
    Annotations for Table objects, to annotate as needed, the notion
    is that the annotation keys correspond to column, and values correspond
    to application specific column metadata.
    """

    _marker = object()
    schema_invariants = ()

    def __init__(self,
                 table_name,
                 columns=(),
Exemple #47
0
multiunionPy = _set_operation(_multiunion, LOSetPy)

try:
    from ._LOBTree import LOBucket
except ImportError:  #pragma NO COVER w/ C extensions
    LOBucket = LOBucketPy
    LOSet = LOSetPy
    LOBTree = LOBTreePy
    LOTreeSet = LOTreeSetPy
    LOTreeIterator = LOTreeIteratorPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
    multiunion = multiunionPy
else:  #pragma NO COVER w/o C extensions
    from ._LOBTree import LOSet
    from ._LOBTree import LOBTree
    from ._LOBTree import LOTreeSet
    from ._LOBTree import LOTreeIterator
    from ._LOBTree import difference
    from ._LOBTree import union
    from ._LOBTree import intersection
    from ._LOBTree import multiunion

Bucket = LOBucket
Set = LOSet
BTree = LOBTree
TreeSet = LOTreeSet

moduleProvides(IIntegerObjectBTreeModule)
    if '_outerWidget' in child.__dict__:
        # print 'parenting', parent, child,
        if '_innerWidget' in parent.__dict__:
            if child._outerWidget.parent is not None:
                raise ValueError, 'child %r is already parented to a %r' % \
                      (child, child._outerWidget.parent)
            # print 'concreted'
            try:
                packer = parent._innerWidget.pack_start
            except AttributeError:
                # maybe it's a Window?
                parent._innerWidget.add(child._outerWidget)
                parent._innerWidget.set_border_width(child.border)
            else:
                packer(child._outerWidget, child.expand, child.fill,
                       child.border)
        else:
            if parent.parent is None:
                # print 'postponed'
                try:
                    parent._childrenToParent.append (child)
                except AttributeError:
                    parent._childrenToParent = [child]
            else:
                # print 'forwarded to', parent.parent
                # logger.warning('using old forwarding; please update %r or %r' \
                #                % (parent, child))
                parent.parent._concreteParenter (child)

moduleProvides(ISkin)
Exemple #49
0
intersectionPy = _set_operation(_intersection, OOSetPy)

try:
    from ._OOBTree import OOBucket
except ImportError as e:  #pragma NO COVER w/ C extensions
    OOBucket = OOBucketPy
    OOSet = OOSetPy
    OOBTree = OOBTreePy
    OOTreeSet = OOTreeSetPy
    OOTreeIterator = OOTreeIteratorPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
else:  #pragma NO COVER w/o C extensions
    from ._OOBTree import OOSet
    from ._OOBTree import OOBTree
    from ._OOBTree import OOTreeSet
    from ._OOBTree import OOTreeIterator
    from ._OOBTree import difference
    from ._OOBTree import union
    from ._OOBTree import intersection

Bucket = OOBucket
Set = OOSet
BTree = OOBTree
TreeSet = OOTreeSet

_fix_pickle(globals(), __name__)

moduleProvides(IObjectObjectBTreeModule)
Exemple #50
0
multiunionPy = _set_operation(_multiunion, LOSetPy)

try:
    from ._LOBTree import LOBucket
except ImportError: #pragma NO COVER w/ C extensions
    LOBucket = LOBucketPy
    LOSet = LOSetPy
    LOBTree = LOBTreePy
    LOTreeSet = LOTreeSetPy
    LOTreeIterator = LOTreeIteratorPy
    difference = differencePy
    union = unionPy
    intersection = intersectionPy
    multiunion = multiunionPy
else: #pragma NO COVER w/o C extensions
    from ._LOBTree import LOSet
    from ._LOBTree import LOBTree
    from ._LOBTree import LOTreeSet
    from ._LOBTree import LOTreeIterator
    from ._LOBTree import difference
    from ._LOBTree import union
    from ._LOBTree import intersection
    from ._LOBTree import multiunion

Bucket = LOBucket
Set = LOSet
BTree = LOBTree
TreeSet = LOTreeSet

moduleProvides(IIntegerObjectBTreeModule)
Exemple #51
0
import os
import errno
import warnings

from zope.interface import moduleProvides

# Twisted imports
from twisted.python.compat import nativeString
from twisted.python.runtime import platform
from twisted.python.filepath import FilePath
from twisted.internet import error, defer, interfaces, protocol
from twisted.python import log, failure
from twisted.names import (dns, common, resolve, cache, root, hosts as
                           hostsModule)

moduleProvides(interfaces.IResolver)


class Resolver(common.ResolverBase):
    """
    @ivar _waiting: A C{dict} mapping tuple keys of query name/type/class to
        Deferreds which will be called back with the result of those queries.
        This is used to avoid issuing the same query more than once in
        parallel.  This is more efficient on the network and helps avoid a
        "birthday paradox" attack by keeping the number of outstanding requests
        for a particular query fixed at one instead of allowing the attacker to
        raise it to an arbitrary number.

    @ivar _reactor: A provider of L{IReactorTCP}, L{IReactorUDP}, and
        L{IReactorTime} which will be used to set up network resources and
        track timeouts.
    def search(term, *args, **kwargs):
        """Searches elements matching the given term.
        """


class ICatalogSearcher(ISearcher):
    """Defines a specialized searcher using a catalog.
    """
    catalog = Object(
        title = u"Catalog in which the search has to occur.",
        schema = ICatalog,
        required = True
        )

    def search(term, index, permission="zope.View"):
        """Searches a catalog for elements matching the term.
        The searcher can check a given permission on the objects
        of the result set.
        """


class ISearchAPI(Interface):
    """The public Search API.
    """
    ISearcher = Attribute("A component dedicated to search")
    ICatalogSearcher = Attribute("A specialized ISearcher querying a catalog")


moduleProvides(ISearchAPI)
__all__ = list(ISearchAPI)
Exemple #53
0
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Processes

$Id$
"""

from zope import component, interface
from zope.wfmc import interfaces

interface.moduleProvides(interfaces.IIntegration)
    
def createParticipant(activity, process_definition_identifier, performer):
    participant = component.queryAdapter(
        activity, interfaces.IParticipant,
        process_definition_identifier + '.' + performer)

    if participant is None:
        participant = component.getAdapter(
            activity, interfaces.IParticipant, '.' + performer)

    return participant

def createWorkItem(participant,
                   process_definition_identifier, application):
Exemple #54
0
#
# Copyright (c) 2006-2007 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Grok
"""
from grokcore.component import *
from grokcore.security import *
from grokcore.view import *

from grokcore.viewlet.components import Viewlet, ViewletManager
from grokcore.viewlet.directive import view, viewletmanager, order

# Import this module so that it's available as soon as you import the
# 'grokcore.view' package.  Useful for tests and interpreter examples.
import grokcore.viewlet.testing

# Our __init__ provides the grok API directly so using 'import grok' is enough.
from grokcore.viewlet.interfaces import IGrokcoreViewletAPI
from zope.interface import moduleProvides
moduleProvides(IGrokcoreViewletAPI)
__all__ = list(IGrokcoreViewletAPI)
Exemple #55
0
import sys
from zope.interface import Interface, moduleProvides, directlyProvides
from zope.interface.interface import InterfaceClass
from zope import schema
from zope.schema.interfaces import ValidationError

from zope.component import provideAdapter

from sqlalchemy import types as rt
import sqlalchemy as rdb

from interfaces import ITableSchema, TransmutationException, IAlchemistTransmutation, \
     IModelAnnotation, IIModelInterface

moduleProvides( IAlchemistTransmutation )

class ColumnTranslator( object ):

    def __init__(self, schema_field):
        self.schema_field = schema_field
        
    def extractInfo( self, column, info ):
        d = {}
        d['title'] = unicode( info.get('label', column.name )  )
        d['description'] = unicode( info.get('description', '' ) )
        d['required'] = not column.nullable

        # this could be all sorts of things ...
        if isinstance( column.default, rdb.ColumnDefault ):
            default = column.default.arg
Exemple #56
0
from grok.components import FormPage
from grok.components import Layout
from grok.components import NotFoundView
from grok.components import Page
from grok.components import UnauthorizedView
from grok.components import View

from grokcore.json import JSON
from grokcore.xmlrpc import XMLRPC

from grokcore.catalog import Indexes
from grokcore.catalog import index

from grokcore.traverser import Traverser
from grokcore.traverser import traversable

from grokcore.rest import IRESTLayer
from grokcore.rest import IRESTSkinType
from grokcore.rest import REST
from grokcore.rest import restskin

# BBB These two functions are meant for test fixtures and should be
# imported from grok.testing, not from grok.
from grok.testing import grok, grok_component

# Our __init__ provides the grok API directly so using 'import grok' is enough.
from grok.interfaces import IGrokAPI
from zope.interface import moduleProvides
moduleProvides(IGrokAPI)
__all__ = list(IGrokAPI)