Skip to content

Commit

Permalink
Remove django-user-accounts dependency
Browse files Browse the repository at this point in the history
Use DUA if it is available, but no longer require it.
If using pinax-templates, version 2.0.0+ is required.
  • Loading branch information
grahamu committed Mar 17, 2018
1 parent 9586f2c commit 94a77e3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
5 changes: 5 additions & 0 deletions pinax/documents/compat.py
Expand Up @@ -4,3 +4,8 @@
except ImportError:
# Python 3
from itertools import zip_longest as izip_longest # noqa

try:
from account.mixins import LoginRequiredMixin
except ImportError:
from django.contrib.auth.mixins import LoginRequiredMixin # noqa
11 changes: 11 additions & 0 deletions pinax/documents/templatetags/pinax_documents_tags.py
@@ -1,4 +1,5 @@
from django.template import Library
from django.utils.html import conditional_escape

from ..utils import convert_bytes

Expand All @@ -15,3 +16,13 @@ def can_share(member, user):
@register.filter
def readable_bytes(bytes):
return convert_bytes(bytes)


@register.simple_tag
def user_display(user):
try:
# Use django-user-accounts display function if available
from account.utils import user_display as account_user_display
return conditional_escape(account_user_display(user))
except ImportError:
return conditional_escape(user.username)
3 changes: 1 addition & 2 deletions pinax/documents/views.py
Expand Up @@ -17,8 +17,7 @@
)
from django.views.generic.edit import FormMixin, ProcessFormView

from account.mixins import LoginRequiredMixin

from .compat import LoginRequiredMixin
from .conf import settings
from .forms import (
ColleagueFolderShareForm,
Expand Down
1 change: 0 additions & 1 deletion runtests.py
Expand Up @@ -17,7 +17,6 @@
"pinax.documents.tests",
"pinax.templates",
"bootstrapform",
"account",
],
MIDDLEWARE=[
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down
17 changes: 12 additions & 5 deletions setup.py
@@ -1,6 +1,8 @@
import os
import sys
from setuptools import find_packages, setup

VERSION = "1.0.1"
VERSION = "1.0.2"
LONG_DESCRIPTION = """
.. image:: http://pinaxproject.com/pinax-design/patches/pinax-documents.svg
:target: https://pypi.python.org/pypi/pinax-documents/
Expand Down Expand Up @@ -48,6 +50,13 @@
+-----------------+-----+-----+-----+-----+
"""


# Publish Helper.
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist bdist_wheel upload')
sys.exit()


setup(
author="Pinax Team",
author_email="team@pinaxprojects.com",
Expand Down Expand Up @@ -81,16 +90,14 @@
],
install_requires=[
"django>=1.11",
"django-appconf>=1.0.1"
"django-appconf>=1.0.2"
],
tests_require=[
"dj-inmemorystorage>=1.4.0",
"django-appconf>=1.0.1",
"django-bootstrap-form>=3.0.0",
"django-test-plus>=1.0.22",
"django-user-accounts>=2.0.3",
"mock>=2.0.0",
"pinax-templates>=1.0.0",
"pinax-templates>=2.0.0",
],
test_suite="runtests.runtests",
zip_safe=False
Expand Down

0 comments on commit 94a77e3

Please sign in to comment.