pycsw迁移向导¶

这个页面提供了pycsw跨版本管理的支持.

pycsw 1.x到2.0的迁移

from pycsw.server import Csw
my_csw = Csw(my_dict)  # add: env=some_environ_dict,  version='2.0.2' if preferred

# using pycsw 1.x
response = my_csw.dispatch_wsgi()

# using pycsw 2.0
http_status_code, response = my_csw.dispatch_wsgi()

# covering either pycsw version
content = csw.dispatch_wsgi()

# pycsw 2.0 has an API break:
# pycsw < 2.0: content = xml_response
# pycsw >= 2.0: content = [http_status_code, content]
# deal with the API break
if isinstance(content, list):  # pycsw 2.0+
    http_response_code, response = content

查看 API 来获取更多的信息。