# -*- coding: utf-8 -*-
from zope.globalrequest.interfaces import IGlobalRequest
from zope.globalrequest.local import getLocal
from zope.globalrequest.local import setLocal
from zope.globalrequest.local import marker
from zope.interface.declarations import moduleProvides

moduleProvides(IGlobalRequest)


def getRequest():
    """ return the currently active request object """
    return getLocal('request')


def setRequest(request):
    """ set the request object to be returned by `getRequest` """
    setLocal('request', request)


def clearRequest():
    """ clear the stored request object """
    setRequest(marker)
Exemple #2
0
from zope.interface.declarations import Declaration
from zope.interface.declarations import alsoProvides
from zope.interface.declarations import classImplements
from zope.interface.declarations import classImplementsOnly
from zope.interface.declarations import classProvides
from zope.interface.declarations import directlyProvidedBy
from zope.interface.declarations import directlyProvides
from zope.interface.declarations import implementedBy
from zope.interface.declarations import implementer
from zope.interface.declarations import implementer_only
from zope.interface.declarations import implements
from zope.interface.declarations import implementsOnly
from zope.interface.declarations import moduleProvides
from zope.interface.declarations import noLongerProvides
from zope.interface.declarations import providedBy
from zope.interface.declarations import provider
from zope.interface.exceptions import Invalid
from zope.interface.interface import Attribute
from zope.interface.interface import invariant
from zope.interface.interface import taggedValue

# The following are to make spec pickles cleaner
from zope.interface.declarations import Provides

from zope.interface.interfaces import IInterfaceDeclaration

moduleProvides(IInterfaceDeclaration)

__all__ = ('Interface', 'Attribute') + tuple(IInterfaceDeclaration)
Exemple #3
0
from zope.interface.declarations import moduleProvides
from zope.globalrequest.interfaces import IGlobalRequest

moduleProvides(IGlobalRequest)


from zope.globalrequest.local import getLocal
from zope.globalrequest.local import setLocal


def getRequest():
    """ return the currently active request object """
    return getLocal('request')


def setRequest(request):
    """ set the request object to be returned by `getRequest` """
    setLocal('request', request)


def clearRequest():
    """ clear the stored request object """
    setRequest(None)
Exemple #4
0
$Id: __init__.py 105433 2009-11-02 08:33:25Z ctheune $
"""
__docformat__ = 'restructuredtext'

from zope.interface.interface import Interface, _wire

# Need to actually get the interface elements to implement the right interfaces
_wire()
del _wire

from zope.interface.interface import Attribute, invariant, taggedValue

from zope.interface.declarations import providedBy, implementedBy
from zope.interface.declarations import classImplements, classImplementsOnly
from zope.interface.declarations import directlyProvidedBy, directlyProvides
from zope.interface.declarations import alsoProvides, implementer
from zope.interface.declarations import implements, implementsOnly
from zope.interface.declarations import classProvides, moduleProvides
from zope.interface.declarations import noLongerProvides, Declaration
from zope.interface.exceptions import Invalid

# The following are to make spec pickles cleaner
from zope.interface.declarations import Provides


from zope.interface.interfaces import IInterfaceDeclaration

moduleProvides(IInterfaceDeclaration)

__all__ = ('Interface', 'Attribute') + tuple(IInterfaceDeclaration)
Exemple #5
0
    from grokcore.security import require
    from grokcore.viewlet import viewletmanager, view
    from zope.session.interfaces import ISession
    from uvc.plone.api import Layout, Form, View, Page, Viewlet, Fields, action
    from uvc.plone.api import Action, SUCCESS, FAILURE, ComposedForm, SubForm
    from uvc.plone.api import get_principal, IPrincipal, Actions
    from uvc.plone.api import ViewletManager
    from five.grok import templatedir
    Menu = MenuItem = SubMenu = TablePage = None

elif ENV is UVCLIGHT:
    try:
        from ul.auth import require
    except ImportError:
        pass
    from uvclight.directives import view, viewletmanager
    from uvclight import menu, get_template
    from uvclight import Layout, Viewlet, Page, View
    from uvclight import action, Fields, Form, DisplayForm, AddForm, EditForm
    from uvclight import Menu, MenuItem, SubMenu, TablePage
    from uvclight.utils import current_principal as get_principal
    from cromlech.browser.interfaces import ISession
    from zope.security.interfaces import IPrincipal
    from cromlech.browser import slot as viewletmanager

else:
    raise NotImplementedError

moduleProvides(UVCAPI)
__all__ = list(UVCAPI)