コード例 #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
ファイル: deploy_plugin.py プロジェクト: vivienney/Ally-Py
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
ファイル: patch_ally_core_http.py プロジェクト: finid/Ally-Py
 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
ファイル: patch_ally_core_http.py プロジェクト: finid/Ally-Py
 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
ファイル: patch_ally_core_http.py プロジェクト: finid/Ally-Py
 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
ファイル: patch_ally_core_http.py プロジェクト: finid/Ally-Py
 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'
         )