Merge remote-tracking branch 'origin/versions/next' into versions/next
This commit is contained in:
+3
-3
@@ -48,6 +48,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
supervisor \
|
supervisor \
|
||||||
tesseract-ocr \
|
tesseract-ocr \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
|
libssl-dev \
|
||||||
&& \
|
&& \
|
||||||
apt-get clean autoclean && \
|
apt-get clean autoclean && \
|
||||||
apt-get autoremove --purge -y && \
|
apt-get autoremove --purge -y && \
|
||||||
@@ -68,7 +69,6 @@ ln -s /usr/lib/aarch64-linux-gnu/libjpeg.so /usr/lib/ \
|
|||||||
|
|
||||||
# Pillow can't find zlib or libjpeg on armv7l (ODROID HC1)
|
# Pillow can't find zlib or libjpeg on armv7l (ODROID HC1)
|
||||||
RUN if [ "$(uname -m)" = "armv7l" ]; then \
|
RUN if [ "$(uname -m)" = "armv7l" ]; then \
|
||||||
apt-get install libssl-dev -y && \
|
|
||||||
ln -s /usr/lib/arm-linux-gnueabihf/libz.so /usr/lib/ && \
|
ln -s /usr/lib/arm-linux-gnueabihf/libz.so /usr/lib/ && \
|
||||||
ln -s /usr/lib/arm-linux-gnueabihf/libjpeg.so /usr/lib/ \
|
ln -s /usr/lib/arm-linux-gnueabihf/libjpeg.so /usr/lib/ \
|
||||||
; fi
|
; fi
|
||||||
@@ -132,11 +132,11 @@ COPY --from=BUILDER_IMAGE /code/docker/version .
|
|||||||
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR
|
RUN chown -R mayan:mayan $PROJECT_INSTALL_DIR
|
||||||
|
|
||||||
# Install build Mayan EDMS
|
# Install build Mayan EDMS
|
||||||
RUN sudo -u mayan $PYTHON_PIP install --no-cache-dir *.whl && \
|
RUN sudo -u mayan $PYTHON_PIP install --no-cache-dir --no-use-pep517 *.whl && \
|
||||||
rm *.whl
|
rm *.whl
|
||||||
|
|
||||||
# Install Python clients for librabbitmq, MySQL, PostgreSQL, REDIS
|
# Install Python clients for librabbitmq, MySQL, PostgreSQL, REDIS
|
||||||
RUN sudo -u mayan $PYTHON_PIP install --no-cache-dir librabbitmq==1.6.1 mysql-python==1.2.5 psycopg2==2.7.3.2 redis==2.10.6
|
RUN sudo -u mayan $PYTHON_PIP install --no-cache-dir --no-use-pep517 librabbitmq==1.6.1 mysql-python==1.2.5 psycopg2==2.7.3.2 redis==2.10.6
|
||||||
|
|
||||||
# Setup supervisor
|
# Setup supervisor
|
||||||
COPY docker/etc/supervisor/mayan.conf /etc/supervisor/conf.d
|
COPY docker/etc/supervisor/mayan.conf /etc/supervisor/conf.d
|
||||||
|
|||||||
@@ -96,10 +96,7 @@ class DocumentCheckoutManager(models.Manager):
|
|||||||
return expired_list
|
return expired_list
|
||||||
|
|
||||||
def is_document_checked_out(self, document):
|
def is_document_checked_out(self, document):
|
||||||
if self.filter(document=document).exists():
|
return self.filter(document=document).exists()
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
class NewVersionBlockManager(models.Manager):
|
class NewVersionBlockManager(models.Manager):
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ from django.conf import settings
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core import management
|
from django.core import management
|
||||||
from django.db import connection
|
from django.db import connection. models
|
||||||
from django.db import models
|
from django.db.models.signals import post_save, pre_save
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.template import Context, Template
|
from django.template import Context, Template
|
||||||
from django.test.utils import ContextList
|
from django.test.utils import ContextList
|
||||||
@@ -176,12 +176,35 @@ class RandomPrimaryKeyModelMonkeyPatchMixin(object):
|
|||||||
if instance.pk:
|
if instance.pk:
|
||||||
return self.method_save_original(instance, *args, **kwargs)
|
return self.method_save_original(instance, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
# Set meta.auto_created to True to have the original save_base
|
||||||
|
# not send the pre_save signal which would normally send
|
||||||
|
# the instance without a primary key. Since we assign a random
|
||||||
|
# primary key any pre_save signal handler that relies on an
|
||||||
|
# empty primary key will fail.
|
||||||
|
# The meta.auto_created and manual pre_save sending emulates
|
||||||
|
# the original behavior. Since meta.auto_created also disables
|
||||||
|
# the post_save signal we must also send it ourselves.
|
||||||
|
# This hack work with Django 1.11 .save_base() but can break
|
||||||
|
# in future versions if that method is updated.
|
||||||
|
pre_save.send(
|
||||||
|
sender=instance.__class__, instance=instance, raw=False,
|
||||||
|
update_fields=None,
|
||||||
|
)
|
||||||
|
instance._meta.auto_created = True
|
||||||
instance.pk = RandomPrimaryKeyModelMonkeyPatchMixin.get_unique_primary_key(
|
instance.pk = RandomPrimaryKeyModelMonkeyPatchMixin.get_unique_primary_key(
|
||||||
model=instance._meta.model
|
model=instance._meta.model
|
||||||
)
|
)
|
||||||
instance.id = instance.pk
|
instance.id = instance.pk
|
||||||
|
|
||||||
return instance.save_base(force_insert=True)
|
result = instance.save_base(force_insert=True)
|
||||||
|
instance._meta.auto_created = False
|
||||||
|
|
||||||
|
post_save.send(
|
||||||
|
sender=instance.__class__, instance=instance, created=True,
|
||||||
|
update_fields=None, raw=False
|
||||||
|
)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
setattr(models.Model, 'save', method_save_new)
|
setattr(models.Model, 'save', method_save_new)
|
||||||
super(RandomPrimaryKeyModelMonkeyPatchMixin, self).setUp()
|
super(RandomPrimaryKeyModelMonkeyPatchMixin, self).setUp()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class IndexTestCase(IndexTemplateTestMixin, DocumentTestMixin, BaseTestCase):
|
|||||||
self._create_document()
|
self._create_document()
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[instance.value for instance in IndexInstanceNode.objects.all()],
|
list(IndexInstanceNode.objects.values_list('value', flat=True)),
|
||||||
[
|
[
|
||||||
'', force_text(self.test_document.date_added.year),
|
'', force_text(self.test_document.date_added.year),
|
||||||
force_text(self.test_document.date_added.month)
|
force_text(self.test_document.date_added.month)
|
||||||
|
|||||||
@@ -270,11 +270,12 @@ class UserViewsTestCase(GroupTestMixin, UserTestMixin, UserViewTestMixin, Generi
|
|||||||
|
|
||||||
self.logout()
|
self.logout()
|
||||||
|
|
||||||
with self.assertRaises(AssertionError):
|
result = self.login(
|
||||||
self.login(
|
username=self.test_user.username,
|
||||||
username=self.test_user.username,
|
password=TEST_USER_PASSWORD_EDITED
|
||||||
password=TEST_USER_PASSWORD_EDITED
|
)
|
||||||
)
|
|
||||||
|
self.assertFalse(result)
|
||||||
|
|
||||||
response = self.get(viewname='user_management:current_user_details')
|
response = self.get(viewname='user_management:current_user_details')
|
||||||
|
|
||||||
@@ -318,11 +319,12 @@ class UserViewsTestCase(GroupTestMixin, UserTestMixin, UserViewTestMixin, Generi
|
|||||||
|
|
||||||
self.logout()
|
self.logout()
|
||||||
|
|
||||||
with self.assertRaises(AssertionError):
|
result = self.login(
|
||||||
self.login(
|
username=self.test_user.username,
|
||||||
username=self.test_user.username,
|
password=TEST_USER_PASSWORD_EDITED
|
||||||
password=TEST_USER_PASSWORD_EDITED
|
)
|
||||||
)
|
|
||||||
|
self.assertFalse(result)
|
||||||
|
|
||||||
response = self.get(viewname='user_management:current_user_details')
|
response = self.get(viewname='user_management:current_user_details')
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|||||||
Reference in New Issue
Block a user