def publisher_1(self, *tokens):
"""Returns a pkg(7) information datastream based on the
the request's publisher or all if not specified."""
prefix = self._get_req_pub()
pubs = []
if not prefix:
pubs = self.repo.get_publishers()
else:
try:
pub = self.repo.get_publisher(prefix)
pubs.append(pub)
except Exception as e:
# If the Publisher object creation fails, return
# a not found error to the client so it will
# treat it as an unsupported operation.
cherrypy.log("Request failed: {0}".format(
str(e)))
raise cherrypy.HTTPError(http_client.NOT_FOUND,
str(e))
buf = cStringIO()
try:
p5i.write(buf, pubs)
except Exception as e:
# Treat any remaining error as a 404, but log it and
# include the real failure information.
cherrypy.log("Request failed: {0}".format(str(e)))
raise cherrypy.HTTPError(http_client.NOT_FOUND, str(e))
buf.seek(0)
self.__set_response_expires("publisher", 86400*365, 86400*365)
return buf.getvalue()
评论列表
文章目录