def require_collection_playable(handler):
    'Decorator that checks if the user can play the given collection.'

    def test_can_play(self, collection_id, **kwargs):
        'Check if the current user can play the collection.'
        actor = rights_manager.Actor(self.user_id)
        can_play = actor.can_play(rights_manager.ACTIVITY_TYPE_COLLECTION, collection_id)
        can_view = actor.can_view(rights_manager.ACTIVITY_TYPE_COLLECTION, collection_id)
        if (can_play and can_view):
            return handler(self, collection_id, **kwargs)
        else:
            raise self.PageNotFoundException
    return test_can_play
Decorator that checks if the user can play the given collection.
def require_collection_playable(handler):
    

    def test_can_play(self, collection_id, **kwargs):
        'Check if the current user can play the collection.'
        actor = rights_manager.Actor(self.user_id)
        can_play = actor.can_play(rights_manager.ACTIVITY_TYPE_COLLECTION, collection_id)
        can_view = actor.can_view(rights_manager.ACTIVITY_TYPE_COLLECTION, collection_id)
        if (can_play and can_view):
            return handler(self, collection_id, **kwargs)
        else:
            raise self.PageNotFoundException
    return test_can_play