Git Product home page Git Product logo

eulfedora's Introduction

eulfedora

package

PyPI

License

PyPI downloads

documentation

Documentation Status

code

travis-ci build

Code Coverage

Code Health

Code Climate

Requirements Status

eulfedora is a Python module that provides utilities, API wrappers, and classes for interacting with the Fedora-Commons Repository in a pythonic, object-oriented way, with optional Django integration. Current versions of eulfedora are intended for use with Fedora Commons 3.7.x or 3.8.x, but will likely work with earlier versions. If you need support for an earlier version of Fedora and the latest eulfedora does not work, you may have success with the 1.0 release.

eulfedora.api provides complete access to the Fedora API, primarily making use of Fedora's REST API. This low-level interface is wrapped by eulfedora.server.Repository and eulfedora.models.DigitalObject, which provide a more abstract, object-oriented, and Pythonic way of interacting with a Fedora Repository or with individual objects and datastreams.

eulfedora.indexdata provides a webservice that returns data for fedora objects in JSON form, which can be used in conjunction with a service for updating an index, such as eulindexer.

When used with Django, eulfedora can pull the Repository connection configuration from Django settings, and provides a custom management command for loading simple content models and fixture objects to the configured repository.

Dependencies

eulfedora currently depends on eulxml, rdflib, python-dateutil, pycrypto, soaplib.

eulfedora can be used without Django, but additional functionality is available when used with Django.

Contact Information

eulfedora was created by the Digital Programs and Systems Software Team of Emory University Libraries.

[email protected]

License

eulfedora is distributed under the Apache 2.0 License.

Development History

For instructions on how to see and interact with the full development history of eulfedora, see eulcore-history.

Developer Notes

To install dependencies for your local check out of the code, run pip install in the eulfedora directory (the use of virtualenv is recommended):

pip install -e .

If you want to run unit tests or build sphinx documentation, you will also need to install development dependencies:

pip install -e . "eulfedora[dev]"

Running the unit tests requires a Fedora Commons repository instance. Before running tests, you will need to copy test/localsettings.py.dist to test/localsettings.py and edit the configuration for your test repository.

To run the tests, you should set an environment variable of DJANGO_SETTINGS_MODULE equal to testsettings.test or prefix the nosetests command with env DJANGO_SETTINGS_MODULE=testsettings.test.

To run all unit tests:

nosetests test # for normal development
nosetests test --with-coverage --cover-package=eulfedora --cover-xml --with-xunit   # for continuous integration

To run unit tests for a specific module or class, use syntax like this:

nosetests test.test_fedora.test_api
nosetests test.test_fedora:TestDigitalObject

To generate sphinx documentation:

cd doc
make html

To upload a tagged release to PyPI with a wheel package:

python setup.py sdist bdist_wheel upload

To upload new artifacts for previously published versions, use twine.

eulfedora's People

Contributors

alexblr avatar athom09 avatar bcail avatar chfw avatar ghukill avatar jayvarner avatar kwbock avatar rlskoeser avatar scande3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eulfedora's Issues

fedora-checksums not repairing

i have a problem using the fedora-checksums script in repair mode. When i run it in validate mode, it says there are 2306 invalid checksum(s), but when i use the repair switch, it says
"Checked 2474 object(s), updated 8 datastream(s), Error saving 12 datastream(s)"
where the 12 datastreams are fedora internal schema objects (so it is probably ok not to update them). But none of the 2306 invalid checksums is updated, no other error messages occur.

i use

  • Fedora Commons 3.6.2
  • EulFedora 0.19.2 - which is a great package :-)
  • the latest version of fedora-checksums script from github

Do i need to upgrade EulFedora to use the repair function of the script?

syncrepo command not found

Hello,

I did a pip install eulfedora, eulcommon but django can't find syncrepo, when I do python manage.py help it shows only :

 cleanup
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
reset
runfcgi
shell
sql
sqlall
sqlclear
sqlcustom
sqlflush
sqlindexes
sqlinitialdata
sqlreset
sqlsequencereset
startapp
startproject
syncdb
test
testserver
validate

Can you help me to debug that problem please ?

TypeError at /objects/simplerepo:1/

'str' object is not callable
Request Method: GET
Request URL: http://localhost:8000/objects/simplerepo:1/
Django Version: 1.5.1
Exception Type: TypeError
Exception Value:
'str' object is not callable
Exception Location: /usr/local/lib/python2.7/site-packages/django/core/handlers/base.py in get_response, line 115
Python Executable: /usr/local/bin/python2.7
Python Version: 2.7.5

Traceback Switch to copy-and-paste view

/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py in get_response
response = callback(request, _callback_args, *_callback_kwargs) ...
โ–ถ Local vars

Retrieving previous versions of a datastream's content

I have an XML datastream that's been modified, and I want to retrieve previous versions of the datastream content.

Here's what I currently have:
obj.api.getDatastreamDissemination(obj.pid, 'MODS', asOfDateTime=obj.mods.history().versions[0].created).text
That gives me the text of the datastream for whichever version I want - but am I missing an easier way?

Something like this would be nice:
obj.mods.history().versions[0].content
That way I wouldn't need to know how to call getDatastreamDissemination. Also, 'content' could return the actual XmlDatastreamObject, like obj.mods.content does.

Checksum Mismatch

Fedora 3.8.1 returns a 500 error with no message if there's a checksum mismatch in addDatastream. This means that ChecksumMismatch doesn't get raised in HTTP_API_BASE._make_request.

Is anyone else seeing this issue? Is there any interest in a patch that would validate the checksum in eulfedora?

Missing Content-Disposition in raw_datastream view

When I download a file directly from fedora, get the content-disposition header set. When I download it through the raw_datastream view, I do not see this header. This is useful if you want to make sure a datastream is downloaded with a specific filename as passed through from fedora.

This made a difference when returning Digital Negative files (dng) which end up having a mimetype image/tiff. I received a file named download.tif as opposed to ORIGINAL_NAME.dng

I'm willing to work on this but not sure where to start.

References to XMLDatastreamObjects being overwritten

I am building a project with multiple DigitalObject models and I have added a few of my own XmlDatastreams using my personal XML Schemas. What I ended up doing was copying dc.py and modifying it so there was one for each XML Schema. It appears to work on an individual basis, however when I have multiple declarations within my models.py Django project, it is pointing all of the XMLDatastreamObjects to the last declared one. For example:

class FileObject(DigitalObject):
FILE_CONTENT_MODEL = 'info:fedora/genrepo:File-1.0'
CONTENT_MODELS = [ FILE_CONTENT_MODEL ]
file = FileDatastream("FILE", "Binary datastream", defaults={
'versionable': True,
})
extra_meta = XmlDatastream("EXTRA_META, "Extra Metadata", ExtraMetaXML)
second_meta = XmlDatastream("SECOND_META", "Second Metadata", SecondMetaXML)

class AnotherObject(DigitalObject):
CONTENT_MODELS = ['info:fedora/%s:ResultsObject' % FEDORA_PIDSPACE]
third_meta = XmlDatastream("THIRD_META", "Third Metadata", ThirdMetaXML)

Using this models.py, both first_meta, second_meta, and third_meta all show up as ThirdMetaXML objects when declaring a new FileObject or AnotherObject (obj.first_meta.content, etc). Commenting out third_meta declaration in models.py makes the remaining two SecondMetaXML.

Am I declaring these XmlDatastreams properly in the models.py or is there another way these datastreams should be declared?

custom panel for django-debug-toolbar

It would be helpful to have a custom panel that could report on the fedora api requests & response time it takes to generate a given django page.

I was able to add something similar for xqueries in eulexistdb based on the caching panel in django-debug-toolbar without too much difficulty, should be a similar way to hook into the api here too. emory-libraries/eulexistdb@814c77f

progressbar versions

With python 2.7, we were getting the error with regards to progressbar:
AttributeError: 'module' object has no attribute 'DataSize'

As it turns out, we had version 2.3, which pip install gave us. Looks like we need newer versions of progressbar that include DataSize under widgets, and those newer versions fall under progressbar2.

Updating progressbar to progressbar2 here worked for us:
https://github.com/emory-libraries/eulfedora/blob/master/setup.py#L58

But didn't want to submit a pull request yet, as maybe there was more thinking behind falling back to progressbar(1) there.

add_relationship() does not recognize object PIDs when provided as unicode strings

Perhaps this is not a bug, and just how unicode and string objects are treated differently with Eulfedora, but it has caused us various bouts of confusion when creating relationships with add_relationship, and thought it might be worth mentioning.

When using add_relationship(), if you provide unicode objects instead of plain strings, they are not added as rdf:resource to the triple, but instead, as string literals.

For example, object_handle.add_relationship(u'fedora-rels-ext:hasContentModel',u'info:fedora:CM:Collection')

would create the RELS-EXT triple, <hasContentModel xmlns="info:fedora/fedora-system:def/relations-external#">info:fedora/CM:Collection</hasContentModel>

Where, object_handle.add_relationship('fedora-rels-ext:hasContentModel','info:fedora:CM:Collection')

would create, <hasContentModel xmlns="info:fedora/fedora-system:def/relations-external#" rdf:resource="info:fedora/CM:Collection"></hasContentModel>

Now that we know to look out for that, it's relatively easy to manage for, but was not obvious at first.

Status of the project

First, thanks for this project, which we've been using for a while.

Is this project still active? Are any PRs going to be accepted? I have forked the project and added some commits - is there any interest in a PR?

Eulfedora and Fedora 4.x

The homepage states that Eulfedora is compatible with Fedora Commons versions up to version 3.8. Is this information still up-to-date? Are there any plans to support current versions of Fedora?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.