def importSchemaComponent(self, pkgname): schema = self.schema if not self._private_schema: # replace the schema with an extended schema on the first %import self._loader = SchemaLoader(self.schema.registry) schema = ZConfig.info.createDerivedSchema(self.schema) self._private_schema = True self.schema = schema url = self._loader.schemaComponentSource(pkgname, '') if schema.hasComponent(url): return schema.addComponent(url) with self.openResource(url) as resource: ZConfig.schema.parseComponent(resource, self._loader, schema)
def importSchemaComponent(self, pkgname): schema = self.schema if not self._private_schema: # replace the schema with an extended schema on the first %import self._loader = SchemaLoader(self.schema.registry) schema = ZConfig.info.createDerivedSchema(self.schema) self._private_schema = True self.schema = schema url = self._loader.schemaComponentSource(pkgname, '') if schema.hasComponent(url): return resource = self.openResource(url) schema.addComponent(url) try: ZConfig.schema.parseComponent(resource, self._loader, schema) finally: resource.close()