def get_server(current_site): # Lookup for existing server first if _servers.has_key(current_site.domain): return _servers[current_site.domain] def create_provider(provider_name): class_ = _safe_import_class(provider_name) return class_(current_site) # Create new objects with site argument providers = [create_provider(p) for p in settings.OAIPMH_PROVIDERS] server = Server(ProxyingServer(providers), metadata_registry=ProxyingMetadataRegistry(providers)) # Memoize _servers[current_site.domain] = server return server
ListMetadataFormats) def metadata_registry(): registry = MetadataRegistry() registry.registerWriter('metashare', MetashareWriter()) registry.registerWriter('olac', OlacWriter()) registry.registerWriter('cmdi', CmdiWriter()) return registry oaipmh_proto_server = OaiPmhServer() oaipmh_server = Server( server=oaipmh_proto_server, metadata_registry=metadata_registry(), resumption_batch_size=1000, ) #========================== # Supported commands #========================== supported_commands = OrderedDict() key_import = u"Import Resource(s)" supported_commands[key_import] = harvest_from_GUI key_list_ids_for_import = u"List Identifiers (use for import)" supported_commands[key_list_ids_for_import] = ListIdentifiers