示例#1
0
 def updateAssemblyForwardForGatewayInternal():
     if server_provide_gateway() == GATEWAY_INTERNAL:
         if server_provide_assemblage() == ASSEMBLAGE_EXTERNAL:
             raise SetupError(
                 'Cannot configure internal gateway with external assemblage'
             )
         elif server_provide_assemblage() == ASSEMBLAGE_INTERNAL:
             raise SetupError(
                 'Cannot configure internal assemblage because the ally core http component is not present'
             )
示例#2
0
def updateAssemblyAssemblage():
    if not server_protocol() >= 'HTTP/1.1':
        raise SetupError('Invalid protocol %s for chunk transfer is available only '
                         'for HTTP/1.1 protocol or greater' % server_protocol())
    assemblyAssemblage().add(internalError(), block(), requestNode(), headerParameterOptions(), content(), assembler(),
                             chunkedTransferEncoding())
    if read_from_params(): assemblyAssemblage().add(headerParameter(), after=internalError())
示例#3
0
 def isInternal():
     '''
     Auxiliar function.
     '''
     if server_provide_assemblage() != ASSEMBLAGE_INTERNAL: return False
     if not server_provide_resources():
         raise SetupError(
             'Cannot configure internal assemblage because the REST resources is not enabled'
         )
     return True
示例#4
0
 def isInternal():
     '''
     Auxiliar function.
     '''
     if server_provide_gateway() != GATEWAY_INTERNAL: return False
     if not server_provide_resources():
         raise SetupError(
             'Cannot configure internal gateway because the REST resources is not enabled'
         )
     return True
示例#5
0
def plugins():
    PACKAGE_EXTENDER.addFreezedPackage('__plugin__.')
    pluginModules = aop.modulesIn('__plugin__.**')
    for module in pluginModules.load().asList():
        if not isPackage(module) and re.match('__plugin__\\.[^\\.]+$',
                                              module.__name__):
            raise SetupError(
                'The plugin setup module \'%s\' is not allowed directly in the __plugin__ package it needs '
                'to be in a sub package' % module.__name__)

    return context.open(pluginModules, included=True)
示例#6
0
文件: bind.py 项目: vivienney/Ally-Py
 def __call__(self, proxy):
     '''
     Called for binding.
     '''
     if not self._binders:
         binders = Assembly.process(self._source)
         if isinstance(binders, (list, tuple)): self._binders = binders
         elif callable(binders): self._binders = (binders,)
         else: raise SetupError('Invalid binders provided from %s' % self._source)
         for binder in self._binders: assert callable(binder), 'Invalid binder call %s' % binder 
     for binder in self._binders: binder(proxy)
示例#7
0
def openPlugins():
    ''' Add the plugins to the python path and also open the assembly for plugins'''
    loadPlugins()
    if not os.path.isfile(configurations_file_path()):
        print('The configuration file "%s" does not exist, create one by running the the application '
              'with "-dump" option' % configurations_file_path())
        sys.exit(1)
    with open(configurations_file_path(), 'r') as f: config = load(f)

    PACKAGE_EXTENDER.addFreezedPackage('__plugin__.')
    pluginModules = aop.modulesIn('__plugin__.**')
    for module in pluginModules.load().asList():
        if not isPackage(module) and re.match('__plugin__\\.[^\\.]+$', module.__name__):
            raise SetupError('The plugin setup module \'%s\' is not allowed directly in the __plugin__ package it needs '
                             'to be in a sub package' % module.__name__)

    context.open(pluginModules, config=config, included=True)
示例#8
0
 def updateAssemblyServerForGatewayInternal():
     if server_provide_gateway() == GATEWAY_INTERNAL:
         if not server_provide_resources():
             raise SetupError('Cannot configure internal gateway because the REST resources is not enabled')
         assemblyServer().add(gatewayRouter(), before=resourcesRouter())
示例#9
0
 def updateAssemblyForwardForResources():
     if server_provide_gateway() == GATEWAY_INTERNAL:
         if not server_provide_resources():
             raise SetupError('Cannot configure internal gateway because the REST resources is not enabled')
         assemblyForward().add(resourcesRouterGateway())
         if server_provide_errors(): assemblyForward().add(errorsRouter(), after=resourcesRouterGateway())
示例#10
0
 def updateAssemblyRESTRequestForResources():
     if server_provide_gateway() == GATEWAY_INTERNAL:
         if not server_provide_resources():
             raise SetupError('Cannot configure internal gateway because the REST resources is not enabled')
         assemblyRESTRequest().add(resourcesRouter())
示例#11
0
 def updateAssemblyForResources():
     if server_provide_gateway() == GATEWAY_INTERNAL:
         raise SetupError('Cannot configure internal gateway because the ally core http component is not present')
示例#12
0
 def updateAssemblyForwardForResources():
     if server_provide_assemblage() == ASSEMBLAGE_INTERNAL:
         raise SetupError(
             'Cannot configure internal assemblage because the ally core http component is not present'
         )