diff --git a/cred/models.py b/cred/models.py index 9baa6309..6fb2fc2e 100644 --- a/cred/models.py +++ b/cred/models.py @@ -38,10 +38,10 @@ def visible(self, user, historical=False, deleted=False): if not historical: qs = qs.filter(latest=None) - qs = qs.filter(Q(group__in=usergroups) - | Q(latest__group__in=usergroups) - | Q(groups__in=usergroups) - | Q(latest__groups__in=usergroups)).distinct() + qs = qs.filter(Q(group__in=usergroups) | + Q(latest__group__in=usergroups) | + Q(groups__in=usergroups) | + Q(latest__groups__in=usergroups)).distinct() return qs diff --git a/ratticweb/context_processors.py b/ratticweb/context_processors.py index 3a07595a..92889be7 100644 --- a/ratticweb/context_processors.py +++ b/ratticweb/context_processors.py @@ -11,8 +11,8 @@ def base_template_reqs(request): 'USE_LDAP_GROUPS': settings.USE_LDAP_GROUPS, 'EXPORT_ENABLED': not settings.RATTIC_DISABLE_EXPORT, 'TEMPLATE_DEBUG': settings.TEMPLATE_DEBUG, - 'ALLOWPWCHANGE': not (settings.LDAP_ENABLED - and not settings.AUTH_LDAP_ALLOW_PASSWORD_CHANGE), + 'ALLOWPWCHANGE': not (settings.LDAP_ENABLED and + not settings.AUTH_LDAP_ALLOW_PASSWORD_CHANGE), 'rattic_icon': 'rattic/img/rattic_icon_normal.png', 'rattic_logo': 'rattic/img/rattic_logo_normal.svg', } diff --git a/ratticweb/static/rattic/css/base.css b/ratticweb/static/rattic/css/base.css index 355ed668..7f0fd90b 100644 --- a/ratticweb/static/rattic/css/base.css +++ b/ratticweb/static/rattic/css/base.css @@ -11,6 +11,10 @@ div.copybutton { display: inline; } +button.btn-pass-fetchcred { + float:right; +} + /* Override some of the selectize defaults */ .selectize-input { width: 220px; @@ -144,5 +148,3 @@ body { .table-responsive-fifth-column tbody td:nth-child(5), .table-responsive-fifth-column thead th:nth-child(5){display: none;} } - - diff --git a/ratticweb/static/rattic/js/newcore.js b/ratticweb/static/rattic/js/newcore.js index 7a5ea404..c5a2e5cf 100644 --- a/ratticweb/static/rattic/js/newcore.js +++ b/ratticweb/static/rattic/js/newcore.js @@ -175,6 +175,8 @@ var RATTIC = (function ($, ZeroClipboard) { target.removeClass('passhidden'); if (target.prop('tagName') == 'INPUT') { target.attr('type', 'text'); + } else if (button.prop('className').indexOf('btn-pass-fetchcred') > -1) { + button.css('visibility','hidden'); } } @@ -329,9 +331,12 @@ var RATTIC = (function ($, ZeroClipboard) { } function _passfetchersync() { - var me = $(this), - cred_id = me.data('cred_id'); - me.text(my.api.getCredWait(cred_id)['password']); + var me = $(this); + // Prevent show/hide of copy from causing password retrieval + if (me.prop('class').indexOf('passhidden') == -1) { + var cred_id = me.data('cred_id'); + me.text(my.api.getCredWait(cred_id)['password']); + } } function _parentFormSubmit() { @@ -779,4 +784,3 @@ $(document).ready(function () { // Start collecting random numbers sjcl.random.startCollectors(); }); - diff --git a/ratticweb/tests/test_storage.py b/ratticweb/tests/test_storage.py index 83ead540..96a93525 100644 --- a/ratticweb/tests/test_storage.py +++ b/ratticweb/tests/test_storage.py @@ -31,7 +31,7 @@ def test_validates_on_enter(self): with mock.patch.object(self.storage, "validate_destination", validate_destination): with self.storage as storage: self.assertIs(storage, self.storage) - self.storage.validate_destination.assert_called_once() + self.storage.validate_destination.assert_called_once_with() @mock.patch("ratticweb.management.commands.storage.S3Connection") def test_doesnt_connect_to_s3_if_no_BACKUP_S3_BUCKET_setting(self, FakeS3Connection): diff --git a/requirements-base.txt b/requirements-base.txt index c95e8599..d44121da 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -14,15 +14,16 @@ pycrypto>=2.6,<2.7 python-dateutil>=2.1,<2.2 python-ldap>=2.4,<2.5 python-mimeparse==0.1.4 -six>=1.6,<1.7 +six==1.10.0 urldecode==0.1 wsgiref==0.1.2 keepassdb==0.2.1 db_backup==0.1.3 -boto==2.26.1 +boto==2.38.0 lxml==3.3.3 celery>=3.1,<3.2 -django-celery>=3.1,<3.2 +django-celery>=3.1,<3.1.17 importlib django-social-auth>=0.7.9 paramiko==1.15.2 +kombu==3.0.26 diff --git a/requirements-dev.txt b/requirements-dev.txt index 2fd79cc1..13499159 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,6 +4,6 @@ nose django_nose nose-testconfig selenium -pep8==1.5.0 +pep8==1.6.2 pyflakes diff --git a/requirements-pip.txt b/requirements-pip.txt new file mode 100644 index 00000000..3d80035d --- /dev/null +++ b/requirements-pip.txt @@ -0,0 +1,2 @@ +pip>=1.5.4 +setuptools>=17.1 diff --git a/runtests.sh b/runtests.sh index ad3f3148..7196ab86 100755 --- a/runtests.sh +++ b/runtests.sh @@ -51,7 +51,7 @@ function runtest() { } if (( $tests_only == 0 )); then - runtest "PEP8" "pep8 --exclude=migrations,lib,static,.ropeproject --ignore=E501,E225,E128,E124 ." + runtest "PEP8" "pep8 --exclude=migrations,lib,static,.ropeproject --ignore=E501,E225,E128,E124,E402 ." runtest "pyflakes" "./pyflakes.sh" fi