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' )
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())
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
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
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)
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)
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)
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())
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())
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())
def updateAssemblyForResources(): if server_provide_gateway() == GATEWAY_INTERNAL: raise SetupError('Cannot configure internal gateway because the ally core http component is not present')
def updateAssemblyForwardForResources(): if server_provide_assemblage() == ASSEMBLAGE_INTERNAL: raise SetupError( 'Cannot configure internal assemblage because the ally core http component is not present' )