(cls, user, include_docs=True)
This method returns all fixture data items owned by the user, their location, or their group.

        :param include_docs: whether to return the fixture data item dicts or just a set of ids
This method returns all fixture data items owned by the user, their location, or their group.
This method returns all fixture data items owned by the user their location or their group .
def by_user(cls, user, include_docs=True):
        """
        This method returns all fixture data items owned by the user, their location, or their group.

        :param include_docs: whether to return the fixture data item dicts or just a set of ids
        """
        group_ids = Group.by_user_id(user.user_id, wrap=False)
        loc_ids = user.sql_location.path if user.sql_location else []

        def make_keys(owner_type, ids):
            return [[user.domain, 'data_item by {}'.format(owner_type), id_]
                    for id_ in ids]

        fixture_ids = set(
            FixtureOwnership.get_db().view('fixtures/ownership',
                keys=(make_keys('user', [user.user_id]) +
                      make_keys('group', group_ids) +
                      make_keys('location', loc_ids)),
                reduce=False,
                wrapper=lambda r: r['value'],
            )
        )
        if include_docs:
            results = cls.get_db().view('_all_docs', keys=list(fixture_ids), include_docs=True)

            # sort the results into those corresponding to real documents
            # and those corresponding to deleted or non-existent documents
            docs = []
            deleted_fixture_ids = set()

            for result in results:
                if result.get('doc'):
                    docs.append(result['doc'])
                elif result.get('error'):
                    assert result['error'] == 'not_found'
                    deleted_fixture_ids.add(result['key'])
                else:
                    assert result['value']['deleted'] is True
                    deleted_fixture_ids.add(result['id'])
            if deleted_fixture_ids:
                # delete ownership documents pointing deleted/non-existent fixture documents
                # this cleanup is necessary since we used to not do this
                remove_deleted_ownerships.delay(list(deleted_fixture_ids), user.domain)
            return docs
        else:
            return fixture_ids
def by_user ( cls , user , include_docs = True ) : group_ids = Group . by_user_id ( user . user_id , wrap = False ) loc_ids = user . sql_location . path if user . sql_location else [ ] def make_keys ( owner_type , ids ) : return [ [ user . domain , 'data_item by {}' . format ( owner_type ) , id_ ] for id_ in ids ] fixture_ids = set ( FixtureOwnership . get_db ( ) . view ( 'fixtures/ownership' , keys = ( make_keys ( 'user' , [ user . user_id ] ) + make_keys ( 'group' , group_ids ) + make_keys ( 'location' , loc_ids ) ) , reduce = False , wrapper = lambda r : r [ 'value' ] , ) ) if include_docs : results = cls . get_db ( ) . view ( '_all_docs' , keys = list ( fixture_ids ) , include_docs = True ) # sort the results into those corresponding to real documents # and those corresponding to deleted or non-existent documents docs = [ ] deleted_fixture_ids = set ( ) for result in results : if result . get ( 'doc' ) : docs . append ( result [ 'doc' ] ) elif result . get ( 'error' ) : assert result [ 'error' ] == 'not_found' deleted_fixture_ids . add ( result [ 'key' ] ) else : assert result [ 'value' ] [ 'deleted' ] is True deleted_fixture_ids . add ( result [ 'id' ] ) if deleted_fixture_ids : # delete ownership documents pointing deleted/non-existent fixture documents # this cleanup is necessary since we used to not do this remove_deleted_ownerships . delay ( list ( deleted_fixture_ids ) , user . domain ) return docs else : return fixture_ids