本文整理匯總了Python中invenio.utils.html.X.responseDate方法的典型用法代碼示例。如果您正苦於以下問題:Python X.responseDate方法的具體用法?Python X.responseDate怎麽用?Python X.responseDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類invenio.utils.html.X
的用法示例。
在下文中一共展示了X.responseDate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: oai_error
# 需要導入模塊: from invenio.utils.html import X [as 別名]
# 或者: from invenio.utils.html.X import responseDate [as 別名]
def oai_error(argd, errors):
"""
Return a well-formatted OAI-PMH error
"""
out = """<?xml version="1.0" encoding="UTF-8"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/
http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">"""
out += X.responseDate()(get_utc_now())
for error_code, error_msg in errors:
assert(error_code in CFG_ERRORS)
if error_code in ("badArgument", "badVerb"):
out += X.request()(oai_get_request_url())
break
else:
## There are no badArgument or badVerb errors so we can
## return the whole request information
out += X.request(**argd)(oai_get_request_url())
for error_code, error_msg in errors:
if error_msg is None:
error_msg = CFG_ERRORS[error_code]
else:
error_msg = "%s %s" % (CFG_ERRORS[error_code], error_msg)
out += X.error(code=error_code)(error_msg)
out += "</OAI-PMH>"
return out
示例2: oai_build_request_element
# 需要導入模塊: from invenio.utils.html import X [as 別名]
# 或者: from invenio.utils.html.X import responseDate [as 別名]
def oai_build_request_element(argd=None):
"""
Build the request tag.
"""
if argd is None:
argd = {}
return X.responseDate()(get_utc_now()) + X.request(**argd)("%s/oai2d" % CFG_SITE_URL or CFG_SITE_SECURE_URL)
示例3: oai_header
# 需要導入模塊: from invenio.utils.html import X [as 別名]
# 或者: from invenio.utils.html.X import responseDate [as 別名]
def oai_header(argd, verb):
"""
Return OAI header
"""
out = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n"
out += "<?xml-stylesheet type=\"text/xsl\" href=\"%s\" ?>\n" % (
url_for('oairepository.static',
filename='xsl/oairepository/oai2.xsl.v1.0'))
out += "<OAI-PMH xmlns=\"http://www.openarchives.org/OAI/2.0/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\">\n"
#out += "<responseDate>%s</responseDate>" % get_utc_now()
out += X.responseDate()(get_utc_now())
if verb:
out += X.request(**argd)(oai_get_request_url())
out += "<%s>\n" % verb
else:
out += X.request()(oai_get_request_url())
return out
示例4: oai_header
# 需要導入模塊: from invenio.utils.html import X [as 別名]
# 或者: from invenio.utils.html.X import responseDate [as 別名]
def oai_header(argd, verb):
"""
Return OAI header
"""
out = '<?xml version="1.0" encoding="UTF-8"?>' + "\n"
out += '<?xml-stylesheet type="text/xsl" href="%s" ?>\n' % (
url_for("oairepository.static", filename="xsl/oairepository/oai2.xsl.v1.0")
)
out += '<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">\n'
# out += "<responseDate>%s</responseDate>" % get_utc_now()
out += X.responseDate()(get_utc_now())
if verb:
out += X.request(**argd)(oai_get_request_url())
out += "<%s>\n" % verb
else:
out += X.request()(oai_get_request_url())
return out