depot.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:solaris-ips 作者: oracle 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号