Пример #1
0
 def collection(self):
     collection_uri = self.rels_ext.content.value(
         subject=self.uriref, predicate=rdfns.relsext.isMemberOfCollection)
     if collection_uri:
         return CollectionObject(
             self.api,
             str(collection_uri).replace('info:fedora/', ''))
Пример #2
0
def list_collections(request):
    """list all collections in repository returns list of
    :class:`~genrepo.collection.models.CollectionObject`
    """
    colls = CollectionObject.all()
    colls = list(accessible(colls))
    colls.sort(key=lambda coll: coll.label.upper())  # sort based on label

    return render(request, "collection/list.html", {"colls": colls})
Пример #3
0
def list_collections(request):
    '''list all collections in repository returns list of
    :class:`~genrepo.collection.models.CollectionObject`
    '''
    colls = CollectionObject.all()
    colls = list(accessible(colls))
    colls.sort(key=lambda coll: coll.label.upper())  # sort based on label

    return render(request, 'collection/list.html', {'colls': colls})
Пример #4
0
 def test_all(self):
     with patch('genrepo.collection.models.Repository') as mockrepo:
         CollectionObject.all()
         mockrepo().get_objects_with_cmodel.assert_called_with(
             CollectionObject.COLLECTION_CONTENT_MODEL,
             type=CollectionObject)
Пример #5
0
 def setUp(self):
     # use an in-ingested collection object with a mock API for now (until we need more)
     self.coll = CollectionObject(Mock())
Пример #6
0
def _collection_options():
    collections = list(accessible(CollectionObject.all()))
    options = [('', '')] + \
        [ ('info:fedora/' + c.pid, c.label or c.pid)
          for c in collections ]
    return options
Пример #7
0
def _collection_options():
    collections = list(accessible(CollectionObject.all()))
    options = [('', '')] + \
        [ ('info:fedora/' + c.pid, c.label or c.pid)
          for c in collections ]
    return options