ahankinson / pybagit

Python library for manipulating bagit files.
http://ahankinson.github.io/pybagit
Other
20 stars 8 forks source link

is_valid method #1

Closed deepanjanroy closed 11 years ago

deepanjanroy commented 11 years ago

I believe this is what you had in mind when you wrote the is_valid method.

deepanjanroy commented 11 years ago

Also, maybe this is not the place to discuss this, but pybagit goes on an infinite loop if there is an empty directory in the data. Do you mind if I add some code to traverse the file tree and then raise an error if the directory is empty? Or I could also preserve the directory by creating an empty file there. The bagit specs say something like this: http://tools.ietf.org/html/draft-kunze-bagit-06#section-2.1.3

ahankinson commented 11 years ago

Could you also verify that this passes the test, or see if there is a test case that would cover this and supply one? You can attach that to this pull request and I'll merge them both in at the same time.

ahankinson commented 11 years ago

For the other question, you should detect an empty directory and, if it is empty, add a .keep file. (It may be that the directory is kept purposefully empty to be filled by downloaded content.

deepanjanroy commented 11 years ago

Unit tests pass and new tests have been added. One outdated test was fixed. The .keep files are now also automatically generated.