)]}'
{"openstack/resource.py":[{"author":{"_account_id":8257,"name":"Brian Curtin","email":"brian@python.org","username":"briancurtin"},"change_message_id":"29d7cd9558a5d19c1f45fab381ab8b7c93b6e83c","unresolved":false,"context_lines":[{"line_number":645,"context_line":"        \"\"\""},{"line_number":646,"context_line":"        if not cls.allow_list:"},{"line_number":647,"context_line":"            raise exceptions.MethodNotSupported(\u0027list\u0027)"},{"line_number":648,"context_line":"        if not cls.allow_paging:"},{"line_number":649,"context_line":"            resp \u003d cls.page(session, None, None, path_args, **params)"},{"line_number":650,"context_line":"            for data in resp:"},{"line_number":651,"context_line":"                yield cls.existing(**data)"}],"source_content_type":"text/x-python","patch_set":1,"id":"da86d52c_b34c3eca","line":648,"updated":"2015-02-15 04:05:55.000000000","message":"After toying with pagination and non-paginated lists on a few different services, I feel that it works best to keep Resource.page and Resource.list as only ever returning one page at a time and multiple pages, respectively, at this level. Since this is a lower-level API, I\u0027m ok with passing a minor bit of complexity on here, in that you have to know what you\u0027re working with, since calling Resource.list to something non-paginated will loop forever trying to paginate it. I also think at this level it is ok to be a little more explicit in that there are different methods for different types of requests and responses.\n\nWhere I think keeping them separate works well is that it doesn\u0027t add any additional configuration, but allows higher level APIs to operate the same across the board - paginated or non-paginated - with the proxy implementor calling one different method.\n\nAnother benefit of leaving them separate for users of the Resource layer are the APIs which support pagination but may be disabled on the server-side. It\u0027ll be easier for them to switch their call from list to page than to have to swap in a subclassed resource that flips an allow_paging flag.\n\nOverall this really isn\u0027t a bad idea, but working with page as a subset of list has turned out to work pretty nicely.","commit_id":"2a7bf674170cc22b25c242a992d811b7eac873d1"}]}
