Commit cc88f19e by Brian Mesick Committed by GitHub

Merge pull request #4 from pmitros/master

Updating fork to pmitros/django-pyfs master
parents d175715e 7121674d
...@@ -52,3 +52,5 @@ coverage.xml ...@@ -52,3 +52,5 @@ coverage.xml
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
# Emacs backups
*~
\ No newline at end of file
include README.md
recursive-include djpyfs *py
recursive-include example *py
\ No newline at end of file
...@@ -22,7 +22,7 @@ expire after a few minutes. Another use case was memoization. ...@@ -22,7 +22,7 @@ expire after a few minutes. Another use case was memoization.
Note that expired files are not automatically removed. To remove them, Note that expired files are not automatically removed. To remove them,
call `expire_objects()`. In our system, we had a cron job do call `expire_objects()`. In our system, we had a cron job do
this. Celery, manual removals, etc. are all options. this for a while. Celery, manual removals, etc. are all options.
To configure a django-pyfs to use static files, set a parameter in To configure a django-pyfs to use static files, set a parameter in
Django settings: Django settings:
...@@ -63,9 +63,7 @@ Good next steps would be to: ...@@ -63,9 +63,7 @@ Good next steps would be to:
* Add better test support. Django does nice things with resetting * Add better test support. Django does nice things with resetting
DBs to a know state for testing. It'd be nice to do the same here. DBs to a know state for testing. It'd be nice to do the same here.
State: This code is tested and has worked well in a range of State: This code is tested and has worked well in a range of settings,
settings. I did just tease it out of a couple of projects which were and is currently deployed on edx.org. However, it doesn't have test
using it, so there may be issues associated with this, but it does cases and similar, so can't be considered truly production-ready. The
appear to work. Much of the codebase could use a cleanup -- it's not expiration functionality, in particular, we are not using right now.
pretty. I also cannot commit to long-term interface stability (but
older versions ought to continue to work). .
...@@ -55,21 +55,13 @@ class FSExpirations(models.Model): ...@@ -55,21 +55,13 @@ class FSExpirations(models.Model):
return cls.objects.filter(expires=True, expiration__lte = expiration_lte) return cls.objects.filter(expires=True, expiration__lte = expiration_lte)
class Meta: class Meta:
app_label = 'djpyfs'
unique_together = (("module","filename")) unique_together = (("module","filename"))
## FIXME: We'd like to create an index first on expiration than on expires (so we can # We'd like to create an index first on expiration than on expires (so we can
## search for objects where expires=True and expiration is before now). Django 1.5 # search for objects where expires=True and expiration is before now).
## supports this, but 1.4 does not. index_together = [
## ["expiration", "expires"],
## I'm putting this in in preparation for 1.5. This is ]
## slightly redundant, since documentation is unclear about
## order of the joint index.
##
## When 1.5 comes out, we can drop the index on expiration.
if django.get_version()>='1.5':
index_together = [
["expires","expiration"],
["expiration","expires"]
]
def __str__(self): def __str__(self):
if self.expires: if self.expires:
......
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)
# Create your views here.
#!/usr/bin/env python #!/usr/bin/env python
from distutils.core import setup import os
from setuptools import setup
setup(name='django-pyfs',
version='1.0', fname = os.path.join(os.path.dirname(__file__), "README.md")
description='Django pyfilesystem integration',
author='Piotr Mitros', if os.path.exists(fname):
author_email='pmitros@edx.org', ld = open(fname).read()
url='http://mitros.org/p/', else:
packages=['djpyfs'], ld = "Django pyfilesystem integration"
)
setup(
name='django-pyfs',
version='1.0.4',
description='Django pyfilesystem integration',
author='Piotr Mitros',
author_email='pmitros@edx.org',
packages=['djpyfs'],
license = "AGPLv3",
url = "https://github.com/edx/django-pyfs",
long_description = ld,
classifiers = [
"Development Status :: 4 - Beta",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
],
install_requires=['fs'],
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment