From 8893568be50154bbc26b81a6102f6748e1fa84e9 Mon Sep 17 00:00:00 2001 From: Sergey Date: Tue, 2 Jun 2020 21:11:49 +0500 Subject: [PATCH 01/31] Change rbtools from github to pypi lib --- .gitmodules | 3 --- anytask/rbtools | 1 - requirements_local.txt | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) delete mode 120000 anytask/rbtools diff --git a/.gitmodules b/.gitmodules index a46667ac8..f26047e3b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,6 +13,3 @@ [submodule "bootbox"] path = dependencies/bootbox url = https://github.com/makeusabrew/bootbox.git -[submodule "rbtools"] - path = dependencies/rbtools - url = https://github.com/reviewboard/rbtools.git diff --git a/anytask/rbtools b/anytask/rbtools deleted file mode 120000 index 9c94132b0..000000000 --- a/anytask/rbtools +++ /dev/null @@ -1 +0,0 @@ -../dependencies/rbtools/rbtools \ No newline at end of file diff --git a/requirements_local.txt b/requirements_local.txt index 0f0434874..0c2e02349 100644 --- a/requirements_local.txt +++ b/requirements_local.txt @@ -33,3 +33,4 @@ flake8==3.7.9 django_premailer==0.2.0 django-environ==0.4 nose==1.3.7 +rbtools==1.0.3 From 6c15109e8002b4bd2e5fd07e8fa7c21d52b9ccba Mon Sep 17 00:00:00 2001 From: Sergey Date: Tue, 2 Jun 2020 21:17:36 +0500 Subject: [PATCH 02/31] Delete dependency rbtools --- dependencies/rbtools | 1 - 1 file changed, 1 deletion(-) delete mode 160000 dependencies/rbtools diff --git a/dependencies/rbtools b/dependencies/rbtools deleted file mode 160000 index 3d347ad30..000000000 --- a/dependencies/rbtools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3d347ad307e3a5075c2379071b6420f2f8d9b377 From 5f9618b7504653fc8500188d9065191a10fa0a03 Mon Sep 17 00:00:00 2001 From: Sergey Date: Tue, 2 Jun 2020 22:17:22 +0500 Subject: [PATCH 03/31] fix some python errors --- anytask/anysvn/urls.py | 7 +++---- anytask/courses/management/commands/course_copy.py | 4 ++-- .../management/commands/fix_seminar_status.py | 2 +- .../commands/send_not_contest_to_contest.py | 2 +- anytask/simple.py | 14 +++++++++----- .../tasks/management/commands/import_perltask.py | 2 +- anytask/users/management/commands/create_shad.py | 2 +- .../users/management/commands/import_cs_users.py | 4 ++-- .../users/management/commands/import_shad_users.py | 2 +- .../registration/backends/__init__.py | 2 +- .../management/commands/cleanupregistration.py | 2 +- .../django-registration/registration/tests/urls.py | 4 ++-- 12 files changed, 25 insertions(+), 22 deletions(-) diff --git a/anytask/anysvn/urls.py b/anytask/anysvn/urls.py index 4e5cb7977..fe4e17bf7 100644 --- a/anytask/anysvn/urls.py +++ b/anytask/anysvn/urls.py @@ -1,8 +1,7 @@ -from django.conf.urls import patterns, url +from django.conf.urls import url from anysvn.views import SvnAccesss -urlpatterns = patterns( - 'anysvn.views', +urlpatterns = [ url(r'^access/$', SvnAccesss.as_view(), name="anysvn.views.SvnAccesss.as_view"), -) +] diff --git a/anytask/courses/management/commands/course_copy.py b/anytask/courses/management/commands/course_copy.py index d63417435..d27d6c7f7 100644 --- a/anytask/courses/management/commands/course_copy.py +++ b/anytask/courses/management/commands/course_copy.py @@ -4,7 +4,7 @@ from courses.models import Course from tasks.models import Task -from xml.dom.minidom import parse +from xml.etree.ElementTree import parse from optparse import make_option import copy @@ -33,7 +33,7 @@ class Command(BaseCommand): ), ) - @transaction.commit_on_success + @transaction.atomic def handle(self, **options): course_id = options['course_id'] if course_id: diff --git a/anytask/issues/management/commands/fix_seminar_status.py b/anytask/issues/management/commands/fix_seminar_status.py index ab6b0290e..43ec95144 100644 --- a/anytask/issues/management/commands/fix_seminar_status.py +++ b/anytask/issues/management/commands/fix_seminar_status.py @@ -5,7 +5,7 @@ from optparse import make_option from django.core.management.base import BaseCommand -from django.db.transaction import commit_on_success +from django.db.transaction import atomic as commit_on_success from django.contrib.auth.models import User from django.db.models import Sum diff --git a/anytask/issues/management/commands/send_not_contest_to_contest.py b/anytask/issues/management/commands/send_not_contest_to_contest.py index 1c898b28c..bb8f01624 100644 --- a/anytask/issues/management/commands/send_not_contest_to_contest.py +++ b/anytask/issues/management/commands/send_not_contest_to_contest.py @@ -6,7 +6,7 @@ from django.conf import settings from django.core.management.base import BaseCommand -from django.db.transaction import commit_on_success +from django.db.transaction import atomic as commit_on_success from django.utils import translation from issues.models import Issue diff --git a/anytask/simple.py b/anytask/simple.py index 1a8e857dc..b1a231262 100644 --- a/anytask/simple.py +++ b/anytask/simple.py @@ -2,12 +2,16 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.db.models import get_app, get_apps -from django.test import _doctest as doctest +# from django.db.models.aggreg import get_app, get_apps +from django.apps import apps +get_app = apps.get_app_config +get_apps = apps.get_app_configs + +import doctest from django.test.utils import setup_test_environment, teardown_test_environment -from django.test.testcases import OutputChecker, DocTestRunner -from django.utils import unittest -from django.utils.importlib import import_module +from doctest import OutputChecker, DocTestRunner +import unittest +from importlib import import_module from django.utils.module_loading import module_has_submodule __all__ = ('DjangoTestSuiteRunner') diff --git a/anytask/tasks/management/commands/import_perltask.py b/anytask/tasks/management/commands/import_perltask.py index 171618e6c..6c484daf1 100644 --- a/anytask/tasks/management/commands/import_perltask.py +++ b/anytask/tasks/management/commands/import_perltask.py @@ -10,7 +10,7 @@ from django.core.management.base import BaseCommand from django.contrib.auth.models import User -from xml.dom.minidom import parse +from xml.etree.ElementTree import parse import sys import datetime from optparse import make_option diff --git a/anytask/users/management/commands/create_shad.py b/anytask/users/management/commands/create_shad.py index ba4afa844..12c3cfefa 100644 --- a/anytask/users/management/commands/create_shad.py +++ b/anytask/users/management/commands/create_shad.py @@ -16,7 +16,7 @@ from years.common import get_or_create_current_year from years.models import Year -from xml.dom.minidom import parse +from xml.etree.ElementTree import parse from optparse import make_option import sys import random diff --git a/anytask/users/management/commands/import_cs_users.py b/anytask/users/management/commands/import_cs_users.py index 31cd29fe4..b7b2911da 100644 --- a/anytask/users/management/commands/import_cs_users.py +++ b/anytask/users/management/commands/import_cs_users.py @@ -7,10 +7,10 @@ """ -from django.core.management.base import NoArgsCommand +from django.core.management.base import BaseCommand as NoArgsCommand from django.contrib.auth.models import User -from xml.dom.minidom import parse +from xml.etree.ElementTree import parse import sys import random import string diff --git a/anytask/users/management/commands/import_shad_users.py b/anytask/users/management/commands/import_shad_users.py index 59db53e79..bbe80aa91 100644 --- a/anytask/users/management/commands/import_shad_users.py +++ b/anytask/users/management/commands/import_shad_users.py @@ -1,4 +1,4 @@ -from django.core.management.base import NoArgsCommand +from django.core.management.base import BaseCommand as NoArgsCommand from django.contrib.auth.models import User from groups.models import Group from django.contrib.auth.forms import PasswordResetForm diff --git a/dependencies/django-registration/registration/backends/__init__.py b/dependencies/django-registration/registration/backends/__init__.py index 39d77f81a..cfe28728f 100644 --- a/dependencies/django-registration/registration/backends/__init__.py +++ b/dependencies/django-registration/registration/backends/__init__.py @@ -6,7 +6,7 @@ try: # pragma: no cover from importlib import import_module # pragma: no cover except ImportError: # pragma: no cover - from django.utils.importlib import import_module # pragma: no cover + from importlib import import_module # pragma: no cover def get_backend(path): """ diff --git a/dependencies/django-registration/registration/management/commands/cleanupregistration.py b/dependencies/django-registration/registration/management/commands/cleanupregistration.py index abec5aed3..e8433564b 100644 --- a/dependencies/django-registration/registration/management/commands/cleanupregistration.py +++ b/dependencies/django-registration/registration/management/commands/cleanupregistration.py @@ -7,7 +7,7 @@ """ -from django.core.management.base import NoArgsCommand +from django.core.management.base import BaseCommand as NoArgsCommand from registration.models import RegistrationProfile diff --git a/dependencies/django-registration/registration/tests/urls.py b/dependencies/django-registration/registration/tests/urls.py index 344a44f02..c834e1a2d 100644 --- a/dependencies/django-registration/registration/tests/urls.py +++ b/dependencies/django-registration/registration/tests/urls.py @@ -17,7 +17,7 @@ from registration.views import register -urlpatterns = patterns('', +urlpatterns = [ # Test the 'activate' view with custom template # name. url(r'^activate-with-template-name/(?P\w+)/$', @@ -85,4 +85,4 @@ url(r'^shad2017/register', 'admission.views.register'), url(r'^shad2017/activate/(?P\w+)/', 'admission.views.activate'), url(r'^shad2017/decline/(?P\w+)/', 'admission.views.decline'), - ) + ] From 7128df468a96b25c0cd85047f4e7a035614963f8 Mon Sep 17 00:00:00 2001 From: Sergey Date: Tue, 2 Jun 2020 23:52:45 +0500 Subject: [PATCH 04/31] Works on python 3.8 --- requirements3_local.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 requirements3_local.txt diff --git a/requirements3_local.txt b/requirements3_local.txt new file mode 100644 index 000000000..67c5e0f5c --- /dev/null +++ b/requirements3_local.txt @@ -0,0 +1,36 @@ +tornado==5 +ipykernel==4.5.2 +django==1.11.29 +pillow==6.2.2 +django-recaptcha==1.4.0 +python-gettext==3.0 +beautifulsoup4 +Werkzeug==0.15.3 +django-extensions==1.6.7 +ipython[notebook]==5.3.0 +ipdb==0.10.2 +sqlparse==0.1.15 +django-debug-toolbar==1.3.2 +django-bootstrap-breadcrumbs==0.9.1 +pycrypto==2.6.1 +python-magic==0.4.15 +django-filemanager==0.0.5 +requests==2.20.0 +flup==1.0.3 +unidecode==1.0.22 +django-dprog-jfu +django-filter==1.1.0 +yandex-oauth-py==0.1.1 +xmltodict==0.11.0 +django-crispy-forms==1.6.0 +mock==3.0.5 +django-colorfield==0.1.14 +django-haystack==2.8.1 +Whoosh==2.7.4 +django-reversion==1.10 +dateutils==0.6.6 +flake8==3.7.9 +django_premailer==0.2.0 +django-environ==0.4 +nose==1.3.7 +rbtools==1.0.3 From 8f70bd22345fd2fb83aa40f365c750f0476639a6 Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 3 Jun 2020 00:03:54 +0500 Subject: [PATCH 05/31] Start fixing tests. Fails 76 tests --- anytask/admission/views.py | 4 ++-- anytask/anycontest/common.py | 2 +- .../management/commands/check_contest.py | 4 ++-- .../commands/send_freezed_run_id_notify.py | 4 ++-- anytask/anycontest/models.py | 2 +- anytask/anyrb/common.py | 2 +- anytask/anyrb/unpacker.py | 2 +- anytask/api/tests.py | 6 +++--- anytask/api/views.py | 4 ++-- anytask/common/ordered_dict.py | 4 ++-- anytask/courses/course_statistics.py | 4 ++-- .../management/commands/course_copy.py | 4 ++-- anytask/courses/models.py | 20 +++++++++---------- anytask/courses/pythontask.py | 6 +++--- anytask/courses/tests.py | 16 +++++++-------- anytask/courses/views.py | 12 +++++------ anytask/django_bootstrap | 1 - anytask/filemanager | 1 - .../groups/management/commands/group_copy.py | 2 +- anytask/groups/models.py | 6 +++--- anytask/invites/models.py | 2 +- .../management/commands/fix_seminar_status.py | 16 +++++++-------- .../management/commands/rewrite_comments.py | 10 +++++----- .../commands/send_issue_duplicate_notify.py | 6 +++--- .../commands/send_not_contest_to_contest.py | 4 ++-- .../management/commands/send_notifications.py | 4 ++-- anytask/issues/model_issue_field.py | 2 +- anytask/issues/model_issue_status.py | 4 ++-- anytask/issues/model_issue_student_filter.py | 2 +- anytask/issues/models.py | 4 ++-- anytask/issues/tests.py | 8 ++++---- anytask/issues/views.py | 2 +- anytask/lessons/models.py | 4 ++-- .../commands/send_mail_notifications.py | 4 ++-- anytask/mail/models.py | 2 +- anytask/mail/views.py | 2 +- anytask/schools/models.py | 6 +++--- anytask/search/views.py | 4 ++-- .../commands/check_task_taken_expires.py | 2 +- .../management/commands/import_perltask.py | 14 ++++++------- .../commands/send_task_notifications.py | 6 +++--- anytask/tasks/models.py | 18 ++++++++--------- anytask/tasks/templatetags/sanitize_html.py | 2 +- anytask/tasks/tests.py | 2 +- .../users/management/commands/create_shad.py | 8 ++++---- .../management/commands/import_cs_users.py | 2 +- .../management/commands/import_shad_users.py | 4 ++-- anytask/users/model_user_status.py | 4 ++-- anytask/users/models.py | 8 ++++---- anytask/users/views.py | 16 +++++++-------- anytask/years/models.py | 2 +- .../registration/backends/__init__.py | 2 +- .../registration/models.py | 6 +++--- .../registration/tests/models.py | 2 +- 54 files changed, 144 insertions(+), 146 deletions(-) delete mode 120000 anytask/django_bootstrap delete mode 120000 anytask/filemanager diff --git a/anytask/admission/views.py b/anytask/admission/views.py index 144fa554a..c8b8d23de 100644 --- a/anytask/admission/views.py +++ b/anytask/admission/views.py @@ -123,10 +123,10 @@ def register(request): if request.META['HTTP_EMAIL'] and request.META['HTTP_EMAIL'] != 'None': user_info['ya_email'] = request.META['HTTP_EMAIL'] - for key, post_data_key in settings.YA_FORMS_FIELDS.iteritems(): + for key, post_data_key in settings.YA_FORMS_FIELDS.items(): user_info[key] = get_post_value(post_data, post_data_key) - for key, post_data_keys in settings.YA_FORMS_FIELDS_ADDITIONAL.iteritems(): + for key, post_data_keys in settings.YA_FORMS_FIELDS_ADDITIONAL.items(): info_json = [] for post_data_key in post_data_keys: info_json.append({ diff --git a/anytask/anycontest/common.py b/anytask/anycontest/common.py index 984af6fbc..0b49bd7e3 100644 --- a/anytask/anycontest/common.py +++ b/anytask/anycontest/common.py @@ -2,7 +2,7 @@ import requests import logging import xmltodict -from BeautifulSoup import BeautifulStoneSoup +from bs4 import BeautifulStoneSoup from django.conf import settings diff --git a/anytask/anycontest/management/commands/check_contest.py b/anytask/anycontest/management/commands/check_contest.py index 27c96da52..ffedd3d1c 100644 --- a/anytask/anycontest/management/commands/check_contest.py +++ b/anytask/anycontest/management/commands/check_contest.py @@ -72,5 +72,5 @@ def handle(self, **options): # set_contest_marks(contest_id, students_info) # logging to cron log - print "Command check_contest check {0} submissions ({1} - with marks) took {2} seconds" \ - .format(len(contest_submissions), contest_marks_len, time.time() - start_time) + print("Command check_contest check {0} submissions ({1} - with marks) took {2} seconds" + .format(len(contest_submissions), contest_marks_len, time.time() - start_time)) diff --git a/anytask/anycontest/management/commands/send_freezed_run_id_notify.py b/anytask/anycontest/management/commands/send_freezed_run_id_notify.py index ef10d1260..b2c23130e 100644 --- a/anytask/anycontest/management/commands/send_freezed_run_id_notify.py +++ b/anytask/anycontest/management/commands/send_freezed_run_id_notify.py @@ -56,5 +56,5 @@ def handle(self, **options): send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [email, "anytask@yandex.ru"]) # logging to cron log - print "Command send_freezed_run_id_notify check {0} submissions took {1} seconds" \ - .format(len(contest_submissions), time.time() - start_time) + print("Command send_freezed_run_id_notify check {0} submissions took {1} seconds" + .format(len(contest_submissions), time.time() - start_time)) diff --git a/anytask/anycontest/models.py b/anytask/anycontest/models.py index 69139e0ba..8e312ba07 100644 --- a/anytask/anycontest/models.py +++ b/anytask/anycontest/models.py @@ -49,7 +49,7 @@ class ContestSubmission(models.Model): sended_notify = models.BooleanField(default=False) - def __unicode__(self): + def __str__(self): return u"{0} {1}".format(self.issue, self.run_id) def upload_contest(self, extension=None, compiler_id=None): diff --git a/anytask/anyrb/common.py b/anytask/anyrb/common.py index 104d06ede..ae907aa4f 100644 --- a/anytask/anyrb/common.py +++ b/anytask/anyrb/common.py @@ -8,7 +8,7 @@ from django.utils.translation import ugettext as _ from rbtools.api.client import RBClient -from unpacker import unpack_files +from .unpacker import unpack_files logger = logging.getLogger('django.request') diff --git a/anytask/anyrb/unpacker.py b/anytask/anyrb/unpacker.py index 7a58d0b01..e35e0bada 100644 --- a/anytask/anyrb/unpacker.py +++ b/anytask/anyrb/unpacker.py @@ -40,7 +40,7 @@ def filename(self): def get_archiver(filename): - for suffix, archiver in ARCHIVERS.iteritems(): + for suffix, archiver in iter(ARCHIVERS.items()): if filename.lower().endswith(suffix): return archiver return None diff --git a/anytask/api/tests.py b/anytask/api/tests.py index 459d57265..05105a8c6 100644 --- a/anytask/api/tests.py +++ b/anytask/api/tests.py @@ -35,7 +35,7 @@ def clean_timestamps(cls, x): x.pop("update_time", None) x.pop("timestamp", None) - for k, v in x.iteritems(): + for k, v in iter(x.items()): cls.clean_timestamps(k) cls.clean_timestamps(v) @@ -94,8 +94,8 @@ def _request(self, username, password, method=None, *args, **kwargs): if method is None: method = self.client.get - http_authorization = "basic " + \ - base64.b64encode("{}:{}".format(username, password)) + http_authorization = "basic " + base64.b64encode("{}:{}".format(username, password) + .encode('utf8')).decode('utf8') kwargs.update({"HTTP_AUTHORIZATION": http_authorization}) return method(*args, **kwargs) diff --git a/anytask/api/views.py b/anytask/api/views.py index bd31b1223..b387e6475 100644 --- a/anytask/api/views.py +++ b/anytask/api/views.py @@ -37,7 +37,7 @@ def check_auth(request, *args, **kwargs): if auth_str_parts[0].lower() != "basic": return get_401_response() - username, password = base64.b64decode(auth_str_parts[1]).split(":", 1) + username, password = base64.b64decode(auth_str_parts[1].encode('utf8')).decode('utf8').split(":", 1) user = authenticate(username=username, password=password) if user is None or not user.is_active: return get_401_response() @@ -153,7 +153,7 @@ def get_issue_filter(data): status_arg = data['status'] filter_args['status_field__id' if status_arg.isdigit() else 'status_field__tag'] = status_arg - for arg, qs_arg in ISSUE_FILTER.iteritems(): + for arg, qs_arg in ISSUE_FILTER.items(): if arg in data: filter_args[qs_arg] = data[arg] diff --git a/anytask/common/ordered_dict.py b/anytask/common/ordered_dict.py index e0d336b22..09f6ee69a 100644 --- a/anytask/common/ordered_dict.py +++ b/anytask/common/ordered_dict.py @@ -4,7 +4,7 @@ try: from thread import get_ident as _get_ident except ImportError: - from dummy_thread import get_ident as _get_ident + from _dummy_thread import get_ident as _get_ident try: from _abcoll import KeysView, ValuesView, ItemsView @@ -134,7 +134,7 @@ def itervalues(self): for k in self: yield self[k] - def iteritems(self): + def items(self): 'od.iteritems -> an iterator over the (key, value) items in od' for k in self: yield (k, self[k]) diff --git a/anytask/courses/course_statistics.py b/anytask/courses/course_statistics.py index 72aaa9f49..039b1ce1d 100644 --- a/anytask/courses/course_statistics.py +++ b/anytask/courses/course_statistics.py @@ -29,7 +29,7 @@ def get_course_statistics(self): ) groups_statistics_list = [] - for group, statistics in self.groups_statistics.iteritems(): + for group, statistics in self.groups_statistics.items(): groups_statistics_list.append(( group, statistics['group_summ_scores'], statistics['number_group_students'], @@ -51,7 +51,7 @@ def get_course_statistics(self): def get_groups_statistics(self): group_student_list = [] - for group, statistics in self.groups_statistics.iteritems(): + for group, statistics in self.groups_statistics.items(): group_student_list.append((group, statistics['students_statistics'])) return group_student_list diff --git a/anytask/courses/management/commands/course_copy.py b/anytask/courses/management/commands/course_copy.py index d27d6c7f7..8d70ae896 100644 --- a/anytask/courses/management/commands/course_copy.py +++ b/anytask/courses/management/commands/course_copy.py @@ -54,7 +54,7 @@ def handle(self, **options): if task_src.has_parent(): continue - print "Copy task {0}".format(task_src.title.encode("utf-8")) + print("Copy task {0}".format(task_src.title.encode("utf-8"))) task_dst = Task() task_dst.__dict__ = copy.deepcopy(task_src.__dict__) task_dst.id = None @@ -62,7 +62,7 @@ def handle(self, **options): task_dst.save() for subtask_src in task_src.get_subtasks(): - print ">Copy subtask {0}".format(subtask_src.title.encode("utf-8")) + print(">Copy subtask {0}".format(subtask_src.title.encode("utf-8"))) subtask_dst = Task() subtask_dst.__dict__ = copy.deepcopy(subtask_src.__dict__) diff --git a/anytask/courses/models.py b/anytask/courses/models.py index 4746d0f3a..2ffe1f9f3 100644 --- a/anytask/courses/models.py +++ b/anytask/courses/models.py @@ -66,7 +66,7 @@ def get_deleted_issue_fields(self): class FilenameExtension(models.Model): name = models.CharField(max_length=10, db_index=False, null=False, blank=False) - def __unicode__(self): + def __str__(self): return self.name @@ -74,7 +74,7 @@ class MarkField(models.Model): name = models.CharField(max_length=191, db_index=True, null=False, blank=False) name_int = models.IntegerField(db_index=False, null=False, blank=False, default=-1) - def __unicode__(self): + def __str__(self): return self.name if self.name else '--' class Meta: @@ -85,8 +85,8 @@ class CourseMarkSystem(models.Model): name = models.CharField(max_length=191, db_index=False, null=False, blank=False) marks = models.ManyToManyField(MarkField, null=True, blank=True) - def __unicode__(self): - return unicode(self.name) + def __str__(self): + return str(self.name) class Course(models.Model): @@ -149,11 +149,11 @@ class Course(models.Model): show_contest_run_id = models.BooleanField(db_index=False, null=False, blank=False, default=True) - def __unicode__(self): - return unicode(self.name) + def __str__(self): + return str(self.name) def get_full_name(self): - return unicode(self.name) + return str(self.name) def get_absolute_url(self): return reverse('courses.views.course_page', args=[str(self.id)]) @@ -267,7 +267,7 @@ class DefaultTeacher(models.Model): course = models.ForeignKey(Course, db_index=True, null=False, blank=False) group = models.ForeignKey(Group, db_index=True, null=True, blank=True) - def __unicode__(self): + def __str__(self): return u"|".join((self.course.name, self.group.name, self.teacher.username)) class Meta: @@ -282,8 +282,8 @@ class StudentCourseMark(models.Model): teacher = models.ForeignKey(User, related_name='teacher_change_mark', db_index=False, null=True, blank=True) update_time = models.DateTimeField(auto_now=True) # remove default=timezone.now - def __unicode__(self): - return unicode(self.mark) + def __str__(self): + return str(self.mark) class Meta: unique_together = (("student", "course"),) diff --git a/anytask/courses/pythontask.py b/anytask/courses/pythontask.py index dca4cacf1..a4abdcb96 100644 --- a/anytask/courses/pythontask.py +++ b/anytask/courses/pythontask.py @@ -26,12 +26,12 @@ def update(self, group): self._course_update(group) def get_group_stat(self): - return [(group, stat['student_stat']) for (group, stat) in self.group_stat.iteritems()] + return [(group, stat['student_stat']) for (group, stat) in self.group_stat.items()] def get_course_stat(self): stat = [ (group, stat['total'], stat['active_students'], stat['avg_score']) - for (group, stat) in self.group_stat.iteritems() + for (group, stat) in self.group_stat.items() ] stat.append( @@ -172,7 +172,7 @@ def get_task(request, course_id, task_id): task_taken.issue = issue task_taken.save() - task_taken.issue.add_comment(unicode(_("zapisalsya_na_task"))) + task_taken.issue.add_comment(str(_("zapisalsya_na_task"))) return redirect('courses.views.course_page', course_id=course_id) diff --git a/anytask/courses/tests.py b/anytask/courses/tests.py index 836afb9e4..b6a19098d 100644 --- a/anytask/courses/tests.py +++ b/anytask/courses/tests.py @@ -14,7 +14,7 @@ from tasks.models import Task, TaskTaken from tasks.management.commands.check_task_taken_expires import Command as CheckTastTakenExpiresCommand -from BeautifulSoup import BeautifulSoup +from bs4 import BeautifulSoup from django.core.urlresolvers import reverse import courses.pythontask import courses.views @@ -23,7 +23,7 @@ def save_result_html(html): with open(r'../test_page.html', 'w') as f: - print html + print(html) f.write(html) @@ -74,14 +74,14 @@ def test_course_create_filled(self): self.assertEqual(course.information, 'information') self.assertEqual(course.year, year) self.assertEqual(course.is_active, True) - self.assertItemsEqual(course.teachers.all(), teachers) - self.assertItemsEqual(course.groups.all(), groups) - self.assertItemsEqual(course.issue_fields.all(), IssueField.objects.exclude(id=10).exclude(id=11)) + self.assertCountEqual(course.teachers.all(), teachers) + self.assertCountEqual(course.groups.all(), groups) + self.assertCountEqual(course.issue_fields.all(), IssueField.objects.exclude(id=10).exclude(id=11)) self.assertEqual(course.contest_integrated, False) self.assertEqual(course.send_rb_and_contest_together, False) self.assertEqual(course.rb_integrated, False) self.assertEqual(course.send_to_contest_from_users, True) - self.assertItemsEqual(course.filename_extensions.all(), filename_extensions) + self.assertCountEqual(course.filename_extensions.all(), filename_extensions) self.assertEqual(course.full_transcript, False) self.assertEqual(course.private, True) self.assertEqual(course.can_be_chosen_by_extern, True) @@ -1196,7 +1196,7 @@ def test_take_subtasks_limit(self): response = client.get( reverse(courses.pythontask.get_task, kwargs={'course_id': self.course.id, 'task_id': self.subtask1.id}), follow=True) - self.assertNotIn("{} {}".format(user.last_name, user.first_name), response.content) + self.assertNotIn("{} {}".format(user.last_name, user.first_name), response.content.decode('utf8')) def test_take_cant_take_tasks_from_one_subtask(self): client = self.client @@ -1204,7 +1204,7 @@ def test_take_cant_take_tasks_from_one_subtask(self): self.assertTrue(client.login(username=user.username, password="password0")) response = client.get(reverse(courses.views.course_page, kwargs={'course_id': self.course.id})) - self.assertNotIn("{} {}".format(user.last_name, user.first_name), response.content) + self.assertNotIn("{} {}".format(user.last_name, user.first_name), response.content.decode('utf8')) response = client.get( reverse(courses.pythontask.get_task, kwargs={'course_id': self.course.id, 'task_id': self.subtask1.id}), diff --git a/anytask/courses/views.py b/anytask/courses/views.py index 47e6f172a..a7a31f413 100644 --- a/anytask/courses/views.py +++ b/anytask/courses/views.py @@ -432,7 +432,7 @@ def tasklist_shad_cpp(request, course, seminar=None, group=None): default_teacher[group] = None group_x_student_information = OrderedDict() - for group, student_x_task_x_task_takens in group_x_student_x_task_takens.iteritems(): + for group, student_x_task_x_task_takens in group_x_student_x_task_takens.items(): group_x_student_information.setdefault(group, []) for student in sorted(student_x_task_x_task_takens.keys(), @@ -494,7 +494,7 @@ def get_course_mark(course, student): student_course_mark = StudentCourseMark.objects.get(course=course, student=student) if student_course_mark.mark: mark_id = student_course_mark.mark.id - course_mark = unicode(student_course_mark) + course_mark = str(student_course_mark) course_mark_int = student_course_mark.mark.name_int except StudentCourseMark.DoesNotExist: pass @@ -627,7 +627,7 @@ def course_settings(request, course_id): context['file_extensions'] = get_filename_extensions(course) return render(request, 'courses/settings.html', context) - for group_key, teacher_id in form.cleaned_data.iteritems(): + for group_key, teacher_id in form.cleaned_data.items(): teacher_id = int(teacher_id) group = form.groups[group_key] if teacher_id == 0: @@ -714,7 +714,7 @@ def set_course_mark(request): student_course_mark.update_time = datetime.datetime.now() student_course_mark.mark = mark student_course_mark.save() - return HttpResponse(json.dumps({'mark': unicode(mark), 'mark_id': mark.id, 'mark_int': mark.name_int}), + return HttpResponse(json.dumps({'mark': str(mark), 'mark_id': mark.id, 'mark_int': mark.name_int}), content_type="application/json") @@ -755,7 +755,7 @@ def change_table_tasks_pos(request): group = get_object_or_404(Group, id=int(request.POST['group_id'])) deleting_ids_from_groups = json.loads(request.POST['deleting_ids_from_groups']) if deleting_ids_from_groups: - for task_id, group_ids in deleting_ids_from_groups.iteritems(): + for task_id, group_ids in deleting_ids_from_groups.items(): group_ids = list(set(group_ids)) task = get_object_or_404(Task, id=int(task_id)) @@ -951,7 +951,7 @@ def attendance_list(request, course, group=None): except DefaultTeacher.DoesNotExist: default_teacher[group] = None group_x_student_information = OrderedDict() - for group, students_x_lessons in group_x_student_x_lessons.iteritems(): + for group, students_x_lessons in group_x_student_x_lessons.items(): group_x_student_information.setdefault(group, []) for student in sorted(students_x_lessons.keys(), diff --git a/anytask/django_bootstrap b/anytask/django_bootstrap deleted file mode 120000 index fa68b9c04..000000000 --- a/anytask/django_bootstrap +++ /dev/null @@ -1 +0,0 @@ -../dependencies/django-bootstrap/bootstrap \ No newline at end of file diff --git a/anytask/filemanager b/anytask/filemanager deleted file mode 120000 index 87c71f8d0..000000000 --- a/anytask/filemanager +++ /dev/null @@ -1 +0,0 @@ -../dependencies/django-filemanager/filemanager \ No newline at end of file diff --git a/anytask/groups/management/commands/group_copy.py b/anytask/groups/management/commands/group_copy.py index 0044c3c92..34c3d8d0e 100644 --- a/anytask/groups/management/commands/group_copy.py +++ b/anytask/groups/management/commands/group_copy.py @@ -36,5 +36,5 @@ def handle(self, **options): group_dst.save() for student_src in group_src.students.all(): - print "Copy student {0}".format(student_src.get_full_name().encode("utf-8")) + print("Copy student {0}".format(student_src.get_full_name().encode("utf-8"))) group_dst.students.add(student_src) diff --git a/anytask/groups/models.py b/anytask/groups/models.py index 17d5f383b..29f5f57c9 100644 --- a/anytask/groups/models.py +++ b/anytask/groups/models.py @@ -15,8 +15,8 @@ class Group(models.Model): class Meta: unique_together = (("year", "name"),) - def __unicode__(self): - return u"{0}|{1}".format(self.year, unicode(self.name)) + def __str__(self): + return u"{0}|{1}".format(self.year, str(self.name)) def get_full_name(self): - return unicode(self.name) + return str(self.name) diff --git a/anytask/invites/models.py b/anytask/invites/models.py index dd01abfdf..b3339fa57 100644 --- a/anytask/invites/models.py +++ b/anytask/invites/models.py @@ -23,7 +23,7 @@ class Invite(models.Model): added_time = models.DateTimeField(auto_now_add=True) # remove default=timezone.now update_time = models.DateTimeField(auto_now=True) # remove default=timezone.now - def __unicode__(self): + def __str__(self): return u"{0}".format(self.key) @staticmethod diff --git a/anytask/issues/management/commands/fix_seminar_status.py b/anytask/issues/management/commands/fix_seminar_status.py index 43ec95144..584e25930 100644 --- a/anytask/issues/management/commands/fix_seminar_status.py +++ b/anytask/issues/management/commands/fix_seminar_status.py @@ -17,10 +17,10 @@ def get_mark(task_id, student_id): return Issue.objects \ - .filter(task__parent_task_id=task_id, student_id=student_id) \ - .exclude(task__is_hidden=True) \ - .exclude(task__score_after_deadline=False, status_field__tag=IssueStatus.STATUS_ACCEPTED_AFTER_DEADLINE) \ - .aggregate(Sum('mark'))['mark__sum'] or 0 + .filter(task__parent_task_id=task_id, student_id=student_id) \ + .exclude(task__is_hidden=True) \ + .exclude(task__score_after_deadline=False, status_field__tag=IssueStatus.STATUS_ACCEPTED_AFTER_DEADLINE) \ + .aggregate(Sum('mark'))['mark__sum'] or 0 class Command(BaseCommand): @@ -86,11 +86,11 @@ def handle(self, **options): issues_created += 1 issues_synced += 1 - print "Student: {0}/{1}\tSeminar: {2}/{3}\tCreated: {4}\tChanged: {5}" \ - .format(i + 1, len(student_ids), j + 1, len(tasks_ids), created, old_mark != new_mark) + print("Student: {0}/{1}\tSeminar: {2}/{3}\tCreated: {4}\tChanged: {5}" + .format(i + 1, len(student_ids), j + 1, len(tasks_ids), created, old_mark != new_mark)) - print ("Command fix_seminar_status fixed status for {0} issues, synced {1} issues " - "(changed mark {2} issues, created {3} issues) for {4} students and took {5} seconds").format( + print("Command fix_seminar_status fixed status for {0} issues, synced {1} issues " + "(changed mark {2} issues, created {3} issues) for {4} students and took {5} seconds").format( len(issues), issues_synced, issues_changed, diff --git a/anytask/issues/management/commands/rewrite_comments.py b/anytask/issues/management/commands/rewrite_comments.py index 3df619bcc..96e79c97a 100644 --- a/anytask/issues/management/commands/rewrite_comments.py +++ b/anytask/issues/management/commands/rewrite_comments.py @@ -42,11 +42,11 @@ def handle(self, **options): raise Exception("--replace is required!") for event in Event.objects.all(): - print "======= {0} =========".format(event.id) - print event.value - print "-----------------------" + print("======= {0} =========".format(event.id)) + print(event.value) + print("-----------------------") event.value = re.sub(pattern, replace, event.value) - print event.value - print "=======================" + print(event.value) + print("=======================") if not dry_run: event.save() diff --git a/anytask/issues/management/commands/send_issue_duplicate_notify.py b/anytask/issues/management/commands/send_issue_duplicate_notify.py index 735e9bfaa..45f2bae41 100644 --- a/anytask/issues/management/commands/send_issue_duplicate_notify.py +++ b/anytask/issues/management/commands/send_issue_duplicate_notify.py @@ -33,7 +33,7 @@ def handle(self, **options): subject = "Duplicate issue" message = "" issues_len = 0 - for key, issues_ids in issues_duplicates.iteritems(): + for key, issues_ids in issues_duplicates.items(): if len(issues_ids) > 1: issues_len += 1 for issue_id in issues_ids: @@ -44,5 +44,5 @@ def handle(self, **options): send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, ["anytask@yandex.ru"]) # logging to cron log - print "Command send_issue_duplicate_notify find {0} issues and took {1} seconds" \ - .format(issues_len, time.time() - start_time) + print("Command send_issue_duplicate_notify find {0} issues and took {1} seconds" + .format(issues_len, time.time() - start_time)) diff --git a/anytask/issues/management/commands/send_not_contest_to_contest.py b/anytask/issues/management/commands/send_not_contest_to_contest.py index bb8f01624..8ef346f90 100644 --- a/anytask/issues/management/commands/send_not_contest_to_contest.py +++ b/anytask/issues/management/commands/send_not_contest_to_contest.py @@ -44,7 +44,7 @@ def handle(self, *args, **options): start_time = time.time() if len(args) == 0: - print "Specify file name" + print("Specify file name") return with open(args[0], 'r') as f: @@ -104,4 +104,4 @@ def handle(self, *args, **options): time.time() - start_time ) - print message + print(message) diff --git a/anytask/issues/management/commands/send_notifications.py b/anytask/issues/management/commands/send_notifications.py index 50813257e..93640e10e 100644 --- a/anytask/issues/management/commands/send_notifications.py +++ b/anytask/issues/management/commands/send_notifications.py @@ -74,8 +74,8 @@ def handle(self, **options): event.save() # logging to cron log - print "Command send_issue_notifications send {0} email(s) and took {1} seconds (sleep {2} seconds)" \ - .format(num_sent, time.time() - start_time, sleep_time) + print("Command send_issue_notifications send {0} email(s) and took {1} seconds (sleep {2} seconds)" + .format(num_sent, time.time() - start_time, sleep_time)) def get_message(user, user_type, issue, events, from_email, domain): diff --git a/anytask/issues/model_issue_field.py b/anytask/issues/model_issue_field.py index 5855028b0..eccc00b74 100644 --- a/anytask/issues/model_issue_field.py +++ b/anytask/issues/model_issue_field.py @@ -155,7 +155,7 @@ def is_loggable(self): def get_value(self, issue): return self.get_plugin().get_value(issue) - def __unicode__(self): + def __str__(self): return u'{0}: {1}/{2} - {3}'.format(self.id, self.plugin, self.name, self.title) diff --git a/anytask/issues/model_issue_status.py b/anytask/issues/model_issue_status.py index baac9b1eb..b0578d92c 100644 --- a/anytask/issues/model_issue_status.py +++ b/anytask/issues/model_issue_status.py @@ -43,7 +43,7 @@ class IssueStatus(models.Model): def get_name(self, lang='ru'): return get_value_from_json(self.name, lang) - def __unicode__(self): + def __str__(self): return u'{0}'.format(self.get_name()) class Meta: @@ -55,7 +55,7 @@ class IssueStatusSystem(models.Model): name = models.CharField(max_length=191, db_index=False, null=False, blank=False) statuses = models.ManyToManyField(IssueStatus, null=True, blank=True) - def __unicode__(self): + def __str__(self): return u'{0}'.format(self.name) def has_accepted_after_deadline(self): diff --git a/anytask/issues/model_issue_student_filter.py b/anytask/issues/model_issue_student_filter.py index 97b1e89e7..a483e1ce3 100644 --- a/anytask/issues/model_issue_student_filter.py +++ b/anytask/issues/model_issue_student_filter.py @@ -34,7 +34,7 @@ def set_user(self, user): status_set = set() for course in courses: course_choices.add((course.id, course.name)) - year_choices.add((course.year.id, unicode(course.year))) + year_choices.add((course.year.id, str(course.year))) for teacher in course.get_teachers(): teacher_set.add(teacher) diff --git a/anytask/issues/models.py b/anytask/issues/models.py index 4f6630bae..ad21cb88f 100644 --- a/anytask/issues/models.py +++ b/anytask/issues/models.py @@ -460,7 +460,7 @@ def get_history(self): | Q(field__name='review_id')).order_by('timestamp') return events - def __unicode__(self): + def __str__(self): return u'Issue: {0} {1}'.format(self.id, self.task.get_title()) def get_absolute_url(self): @@ -544,7 +544,7 @@ def is_change(self): # traceback.print_stack() # return super(self.__class__, self).save(*a, **ka) - def __unicode__(self): + def __str__(self): if not self.author: ret = u'{0} nobody'.format(self.issue.id) else: diff --git a/anytask/issues/tests.py b/anytask/issues/tests.py index 729cfe4f9..4bfe92fe4 100644 --- a/anytask/issues/tests.py +++ b/anytask/issues/tests.py @@ -19,7 +19,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile from mock import patch -from BeautifulSoup import BeautifulSoup +from bs4 import BeautifulSoup from datetime import datetime, timedelta from django.core.urlresolvers import reverse @@ -239,15 +239,15 @@ def test_get_or_create_with_teacher(self): self.assertEqual(len(forms[2]('option')), 3, '6th issue field select option len is not 4') self.assertIn('value="3"', str(forms[2]('option')[0]), '6th issue field select 1st option value wrong') self.assertIn(u'На проверке', - unicode(forms[2]('option')[0]), + str(forms[2]('option')[0]), '6th issue field select 1st option text wrong') self.assertIn('value="4"', str(forms[2]('option')[1]), '6th issue field select 2st option value wrong') self.assertIn(u'На доработке', - unicode(forms[2]('option')[1]), + str(forms[2]('option')[1]), '6th issue field select 2st option text wrong') self.assertIn('value="5"', str(forms[2]('option')[2]), '6th issue field select 3st option value wrong') self.assertIn(u'Зачтено', - unicode(forms[2]('option')[2]), + str(forms[2]('option')[2]), '6th issue field select 3st option text wrong') self.assertEqual(len(forms[2]('button')), 1, '6th issue field button len is not 1') self.assertEqual(forms[2]('button')[0].string.strip().strip('\n'), diff --git a/anytask/issues/views.py b/anytask/issues/views.py index 1facdb157..4861cb970 100644 --- a/anytask/issues/views.py +++ b/anytask/issues/views.py @@ -270,7 +270,7 @@ def upload(request): event_value = {'files': [], 'comment': '', 'compilers': []} event_value['comment'] = request.POST['comment'] file_counter = 0 - for field, value in dict(request.POST).iteritems(): + for field, value in dict(request.POST).items(): if 'compiler' in field: pk = int(field[13:]) file = File.objects.get(pk=pk) diff --git a/anytask/lessons/models.py b/anytask/lessons/models.py index ea3b0aa89..0442effd5 100644 --- a/anytask/lessons/models.py +++ b/anytask/lessons/models.py @@ -33,8 +33,8 @@ class Lesson(models.Model): date_end = models.DateTimeField(auto_now=False, null=True, default=None) days = models.CharField(max_length=100, db_index=True, null=True, blank=True) - def __unicode__(self): - return unicode(self.title) + def __str__(self): + return str(self.title) def set_position(self): self.position = int(self.date_starttime.strftime('%y%m%d%H%M')) diff --git a/anytask/mail/management/commands/send_mail_notifications.py b/anytask/mail/management/commands/send_mail_notifications.py index 089e05231..93f7b1b0b 100644 --- a/anytask/mail/management/commands/send_mail_notifications.py +++ b/anytask/mail/management/commands/send_mail_notifications.py @@ -41,8 +41,8 @@ def handle(self, **options): sleep_time += 1 # logging to cron log - print "Command send_mail_notifications send {0} email(s) and took {1} seconds (sleep {2} seconds)" \ - .format(num_sent, time.time() - start_time, sleep_time) + print("Command send_mail_notifications send {0} email(s) and took {1} seconds (sleep {2} seconds)" + .format(num_sent, time.time() - start_time, sleep_time)) def send_only_notify(domain, from_email): diff --git a/anytask/mail/models.py b/anytask/mail/models.py index 2c8d31ebd..813863959 100644 --- a/anytask/mail/models.py +++ b/anytask/mail/models.py @@ -27,7 +27,7 @@ class Message(models.Model): create_time = models.DateTimeField(auto_now_add=True) # remove default=timezone.now - def __unicode__(self): + def __str__(self): return u'%s %s' % (self.sender.username, self.title) def read_message(self, user): diff --git a/anytask/mail/views.py b/anytask/mail/views.py index 20143a77b..4e38e0423 100644 --- a/anytask/mail/views.py +++ b/anytask/mail/views.py @@ -150,7 +150,7 @@ def format_date(date): if now.day == date.day and now.month == date.month: date_str = date.strftime("%H:%M") else: - date_str = unicode(date.day) + u" " + MONTH[date.month] + date_str = str(date.day) + u" " + MONTH[date.month] else: date_str = date.strftime("%d.%m.%y") diff --git a/anytask/schools/models.py b/anytask/schools/models.py index fdc1587a1..c5db87900 100644 --- a/anytask/schools/models.py +++ b/anytask/schools/models.py @@ -10,11 +10,11 @@ class School(models.Model): link = models.CharField(max_length=191, db_index=False, null=False, blank=False) courses = models.ManyToManyField(Course, null=True, blank=True) - def __unicode__(self): - return unicode(self.name) + def __str__(self): + return str(self.name) def get_full_name(self): - return unicode(self.name) + return str(self.name) def get_absolute_url(self): return reverse('schools.views.school_page', args=[str(self.link)]) diff --git a/anytask/search/views.py b/anytask/search/views.py index 1c984fd7b..736c1bcff 100644 --- a/anytask/search/views.py +++ b/anytask/search/views.py @@ -175,8 +175,8 @@ def search_courses(query, user, max_result=None): for sg in sgs_name[:max_result]: result.append({ - 'name': unicode(sg.object.name), - 'year': unicode(sg.object.year), + 'name': str(sg.object.name), + 'year': str(sg.object.year), 'url': sg.object.get_absolute_url(), 'schools': [sch.name for sch in sg.object.school_set.all()], 'is_active': sg.object.is_active diff --git a/anytask/tasks/management/commands/check_task_taken_expires.py b/anytask/tasks/management/commands/check_task_taken_expires.py index 8a57c38d0..f51e08bb8 100644 --- a/anytask/tasks/management/commands/check_task_taken_expires.py +++ b/anytask/tasks/management/commands/check_task_taken_expires.py @@ -91,4 +91,4 @@ def handle(self, *args, **options): self.check_blacklist_expires(course) if self.need_print: - print "\n".join(self.out_lines) + print("\n".join(self.out_lines)) diff --git a/anytask/tasks/management/commands/import_perltask.py b/anytask/tasks/management/commands/import_perltask.py index 6c484daf1..6f0b5ce83 100644 --- a/anytask/tasks/management/commands/import_perltask.py +++ b/anytask/tasks/management/commands/import_perltask.py @@ -58,8 +58,8 @@ def import_tasktakens(task_obj, tasktakens_el, year): except User.MultipleObjectsReturned: user_count = User.objects.filter(first_name=first_name, last_name=last_name).count() user = User.objects.filter(first_name=first_name, last_name=last_name)[user_count - 1] - print "WARNING user '{0}' MultipleObjectsReturned, selected: '{1}'".format( - user.get_full_name().encode("utf-8"), user) + print("WARNING user '{0}' MultipleObjectsReturned, selected: '{1}'".format( + user.get_full_name().encode("utf-8"), user)) task_taken, _ = TaskTaken.objects.get_or_create(user=user, task=task_obj) group, _ = Group.objects.get_or_create(year=year, name=group_name) @@ -83,14 +83,14 @@ def import_tasktakens(task_obj, tasktakens_el, year): if field.name == "update_time": field.auto_now = True - print ">>>>{0} {1} {2} {3}".format(user, user.get_full_name().encode("utf-8"), group, score) + print(">>>>{0} {1} {2} {3}".format(user, user.get_full_name().encode("utf-8"), group, score)) def import_task_no_subtasks(task_el, course, year): max_score = task_el.getAttribute('b') title = task_el.getElementsByTagName('th')[0].firstChild.data.rsplit('[', 1)[0].strip() weight = task_el.getAttribute('n') - print title + print(title) text = "\n".join(get_task_lines(task_el)) task_obj, _ = Task.objects.get_or_create(title=title, course=course, task_text=text, score_max=max_score) task_obj.weight = weight @@ -104,7 +104,7 @@ def import_task_no_subtasks(task_el, course, year): def import_task_with_subtasks(task_el, course, year): title = task_el.getElementsByTagName('th')[0].firstChild.data.rsplit('[', 1)[0] weight = task_el.getAttribute('n') - print title + print(title) text = "\n".join(get_task_lines(task_el)) parent_task, _ = Task.objects.get_or_create(title=title, course=course, task_text=text) parent_task.weight = weight @@ -112,7 +112,7 @@ def import_task_with_subtasks(task_el, course, year): for subtask_el in task_el.getElementsByTagName('tm')[0].getElementsByTagName('t'): title = subtask_el.getAttribute('h').rsplit('[', 1)[0] weight = subtask_el.getAttribute('m') - print ">>" + title + print(">>" + title) max_score = subtask_el.getAttribute('b') subtask_obj, _ = Task.objects.get_or_create(title=title, course=course, score_max=max_score, parent_task=parent_task) @@ -129,7 +129,7 @@ def import_perltask(perltask_xml, year=None): year = get_or_create_current_year() course, created = Course.objects.get_or_create(year=year, name='Perltask') if created: - print "WARNING: NEW Course created!" + print("WARNING: NEW Course created!") course.type = Course.TYPE_POTOK course.take_policy = Course.TAKE_POLICY_SELF_TAKEN course.max_users_per_task = 8 diff --git a/anytask/tasks/management/commands/send_task_notifications.py b/anytask/tasks/management/commands/send_task_notifications.py index 6feee0c1e..d8d2280da 100644 --- a/anytask/tasks/management/commands/send_task_notifications.py +++ b/anytask/tasks/management/commands/send_task_notifications.py @@ -113,7 +113,7 @@ def handle(self, **options): domain = Site.objects.get_current().domain from_email = settings.DEFAULT_FROM_EMAIL notify_messages = [] - for key_user, courses_info in students_tasks_info.iteritems(): + for key_user, courses_info in students_tasks_info.items(): user = courses_info['user'] if not user.email: continue @@ -139,5 +139,5 @@ def handle(self, **options): num_sent = send_mass_mail_html(notify_messages) # logging to cron log - print "Command send_task_notifications send {0} email(s) and took {1} seconds"\ - .format(num_sent, time.time() - start_time) + print("Command send_task_notifications send {0} email(s) and took {1} seconds" + .format(num_sent, time.time() - start_time)) diff --git a/anytask/tasks/models.py b/anytask/tasks/models.py index 6b095a35c..4f7f2a32f 100644 --- a/anytask/tasks/models.py +++ b/anytask/tasks/models.py @@ -33,7 +33,7 @@ def get_lang_text(text, lang): if text_: lang = lang if lang in text_ else settings.LANGUAGE_CODE return text_[lang] - return unicode(text) + return str(text) class Task(models.Model): @@ -91,8 +91,8 @@ class Task(models.Model): nb_assignment_name = models.CharField(max_length=255, null=True, blank=True) - def __unicode__(self): - return unicode(self.title) + def __str__(self): + return str(self.title) def get_title(self, lang=settings.LANGUAGE_CODE): return escape(get_lang_text(self.title, lang)) @@ -277,8 +277,8 @@ class TaskLog(models.Model): contest_id = models.IntegerField(db_index=True, null=False, blank=False, default=0) problem_id = models.CharField(max_length=128, db_index=True, null=True, blank=True) - def __unicode__(self): - return unicode(self.title) + def __str__(self): + return str(self.title) class TaskTaken(models.Model): @@ -367,8 +367,8 @@ def mark_deleted(self): class Meta: unique_together = (("user", "task"),) - def __unicode__(self): - return unicode(self.task) + " (" + unicode(self.user) + ")" + def __str__(self): + return str(self.task) + " (" + str(self.user) + ")" class TaskGroupRelations(models.Model): @@ -382,8 +382,8 @@ class TaskGroupRelations(models.Model): class Meta: unique_together = ("task", "group") - def __unicode__(self): - return ' '.join([unicode(self.task), unicode(self.group), unicode(self.position)]) + def __str__(self): + return ' '.join([str(self.task), str(self.group), str(self.position)]) def task_save_to_log_post_save(sender, instance, created, **kwargs): diff --git a/anytask/tasks/templatetags/sanitize_html.py b/anytask/tasks/templatetags/sanitize_html.py index c7566395f..4b0323627 100644 --- a/anytask/tasks/templatetags/sanitize_html.py +++ b/anytask/tasks/templatetags/sanitize_html.py @@ -1,4 +1,4 @@ -from BeautifulSoup import BeautifulSoup, Comment +from bs4 import BeautifulSoup, Comment from django import template register = template.Library() diff --git a/anytask/tasks/tests.py b/anytask/tasks/tests.py index 058924ba2..a4ead334c 100644 --- a/anytask/tasks/tests.py +++ b/anytask/tasks/tests.py @@ -16,7 +16,7 @@ from tasks.models import Task, TaskGroupRelations from mock import patch -from BeautifulSoup import BeautifulSoup +from bs4 import BeautifulSoup from datetime import datetime, timedelta from django.core.urlresolvers import reverse diff --git a/anytask/users/management/commands/create_shad.py b/anytask/users/management/commands/create_shad.py index 12c3cfefa..f549f223e 100644 --- a/anytask/users/management/commands/create_shad.py +++ b/anytask/users/management/commands/create_shad.py @@ -56,12 +56,12 @@ def handle(self, **options): school, created = School.objects.get_or_create(link='shad', name='School of Data Analysis') if created: - print "WARNING: NEW School created!" + print("WARNING: NEW School created!") school.save() course, created = Course.objects.get_or_create(year=year, name='Python') if created: - print "WARNING: NEW Course created!" + print("WARNING: NEW Course created!") course.is_active = True course.contest_integrated = True course.save() @@ -76,7 +76,7 @@ def handle(self, **options): try: user = User.objects.get(username__iexact=username) except User.DoesNotExist: - print "Creating new user! : {0}".format(username.encode("utf-8")) + print("Creating new user! : {0}".format(username.encode("utf-8"))) user = User.objects.create(username=username) user.last_name = last_name user.first_name = first_name @@ -88,4 +88,4 @@ def handle(self, **options): group, _ = Group.objects.get_or_create(year=year, name=group_name) course.groups.add(group) group.students.add(user) - print "{0} {1} {2}".format(user, user.get_full_name().encode("utf-8"), group) + print("{0} {1} {2}".format(user, user.get_full_name().encode("utf-8"), group)) diff --git a/anytask/users/management/commands/import_cs_users.py b/anytask/users/management/commands/import_cs_users.py index b7b2911da..aaeec791d 100644 --- a/anytask/users/management/commands/import_cs_users.py +++ b/anytask/users/management/commands/import_cs_users.py @@ -44,4 +44,4 @@ def handle_noargs(self, **options): user.set_password(''.join(random.choice(string.letters) for i in xrange(20))) user.save() - print "{0} {1}".format(user, user.get_full_name().encode("utf-8")) + print("{0} {1}".format(user, user.get_full_name().encode("utf-8"))) diff --git a/anytask/users/management/commands/import_shad_users.py b/anytask/users/management/commands/import_shad_users.py index bbe80aa91..2375269b7 100644 --- a/anytask/users/management/commands/import_shad_users.py +++ b/anytask/users/management/commands/import_shad_users.py @@ -23,14 +23,14 @@ def handle_noargs(self, **options): username = email.split('@')[0] last_name = fields[1] first_name = fields[2] - print email, username, last_name, first_name + print(email, username, last_name, first_name) user, created = User.objects.get_or_create(username=username, first_name=first_name, last_name=last_name, email=email) group.students.add(user) reset_form = PasswordResetForm({'email': email}) - print reset_form + print(reset_form) reset_form.save() group.save() diff --git a/anytask/users/model_user_status.py b/anytask/users/model_user_status.py index 139ba64b3..3b7955f31 100644 --- a/anytask/users/model_user_status.py +++ b/anytask/users/model_user_status.py @@ -44,11 +44,11 @@ class UserStatus(models.Model): tag = models.CharField(max_length=254, db_index=False, null=True, blank=True, choices=USER_STATUSES) color = ColorField(default=COLOR_DEFAULT) - def __unicode__(self): + def __str__(self): return u'{0}'.format(self.name) def get_full_name(self): - return unicode(self.name) + return str(self.name) def get_statuses(): diff --git a/anytask/users/models.py b/anytask/users/models.py index 205ba8ae3..ab28e2553 100644 --- a/anytask/users/models.py +++ b/anytask/users/models.py @@ -82,8 +82,8 @@ class UserProfile(models.Model): def is_current_year_student(self): return Group.objects.filter(year=get_current_year()).filter(students=self.user).count() > 0 - def __unicode__(self): - return unicode(self.user) + def __str__(self): + return str(self.user) def is_active(self): for status in self.user_status.all(): @@ -169,8 +169,8 @@ class UserProfileLog(models.Model): def is_current_year_student(self): return Group.objects.filter(year=get_current_year()).filter(students=self.user).count() > 0 - def __unicode__(self): - return unicode(self.user) + def __str__(self): + return str(self.user) def create_user_profile(sender, instance, created, **kwargs): diff --git a/anytask/users/views.py b/anytask/users/views.py index 0cb51ecdb..a7baae128 100644 --- a/anytask/users/views.py +++ b/anytask/users/views.py @@ -33,7 +33,7 @@ from crispy_forms.helper import FormHelper from crispy_forms.layout import HTML from dateutil.relativedelta import relativedelta -from urlparse import urlparse +from urllib.parse import urlparse import yandex_oauth import requests @@ -170,7 +170,7 @@ def profile(request, username=None, year=None): 'groups': group_by_year(groups), 'teacher_in_courses': group_by_year(teacher_in_courses), 'teacher_in_courses_archive': group_by_year(teacher_in_courses_archive), - 'current_year': unicode(current_year) if current_year is not None else '', + 'current_year': str(current_year) if current_year is not None else '', 'can_generate_invites': can_generate_invites, 'invite_form': invite_form, 'user_to_show_profile': user_to_show_profile, @@ -186,13 +186,13 @@ def profile(request, username=None, year=None): def group_by_year(objects): group_dict = {} for obj in objects: - year = unicode(obj.year) + year = str(obj.year) if year in group_dict: group_dict[year].append(obj) else: group_dict[year] = [obj] - return sorted(group_dict.iteritems()) + return sorted(group_dict.items()) @login_required @@ -288,7 +288,7 @@ def set_user_statuses(request, username=None): reversion.set_comment("Change from user profile") except Exception as e: is_error = True - error = unicode(e) + error = str(e) user_statuses = list(user_profile.user_status.all().values("name", "color")) @@ -576,7 +576,7 @@ def user_courses(request, username=None, year=None): new_course_statistics['summ_score'] = student_summ_score is_archive = int(not course.is_active) - table_year = unicode(course.year) + table_year = str(course.year) table_key = course.issue_status_system.id if table_year not in tables[is_archive]: @@ -588,8 +588,8 @@ def user_courses(request, username=None, year=None): tables[is_archive][table_year][table_key] = [new_course_statistics] context = { - 'tables': [sorted(x.iteritems()) for x in tables], - 'current_year': unicode(current_year) if current_year is not None else '', + 'tables': [sorted(x.items()) for x in tables], + 'current_year': str(current_year) if current_year is not None else '', 'user_to_show': user_to_show, 'user': user, } diff --git a/anytask/years/models.py b/anytask/years/models.py index 6c0014cbe..8afd5e1d3 100644 --- a/anytask/years/models.py +++ b/anytask/years/models.py @@ -8,7 +8,7 @@ class Year(models.Model): added_time = models.DateTimeField(auto_now_add=True) # remove default=timezone.now update_time = models.DateTimeField(auto_now=True) # remove default=timezone.now - def __unicode__(self): + def __str__(self): return u"{0}-{1}".format(self.start_year, self.start_year + 1) def get_absolute_url(self): diff --git a/dependencies/django-registration/registration/backends/__init__.py b/dependencies/django-registration/registration/backends/__init__.py index cfe28728f..01a4c6847 100644 --- a/dependencies/django-registration/registration/backends/__init__.py +++ b/dependencies/django-registration/registration/backends/__init__.py @@ -23,7 +23,7 @@ def get_backend(path): module, attr = path[:i], path[i+1:] try: mod = import_module(module) - except ImportError, e: + except ImportError as e: raise ImproperlyConfigured('Error loading registration backend %s: "%s"' % (module, e)) try: backend_class = getattr(mod, attr) diff --git a/dependencies/django-registration/registration/models.py b/dependencies/django-registration/registration/models.py index ff08f89d4..8736df1a7 100644 --- a/dependencies/django-registration/registration/models.py +++ b/dependencies/django-registration/registration/models.py @@ -94,9 +94,9 @@ def create_profile(self, user): username and a random salt. """ - salt = hashlib.sha1(str(random.random())).hexdigest()[:5] + salt = hashlib.sha1(str(random.random()).encode('utf8')).hexdigest()[:5].encode('utf8') username = user.username - if isinstance(username, unicode): + if isinstance(username, str): username = username.encode('utf-8') activation_key = hashlib.sha1(salt+username).hexdigest() return self.create(user=user, @@ -179,7 +179,7 @@ class Meta: verbose_name = _('registration profile') verbose_name_plural = _('registration profiles') - def __unicode__(self): + def __str__(self): return u"Registration information for %s" % self.user def activation_key_expired(self): diff --git a/dependencies/django-registration/registration/tests/models.py b/dependencies/django-registration/registration/tests/models.py index 5d733a189..64f402a6c 100644 --- a/dependencies/django-registration/registration/tests/models.py +++ b/dependencies/django-registration/registration/tests/models.py @@ -41,7 +41,7 @@ def test_profile_creation(self): self.assertEqual(RegistrationProfile.objects.count(), 1) self.assertEqual(profile.user.id, new_user.id) self.failUnless(re.match('^[a-f0-9]{40}$', profile.activation_key)) - self.assertEqual(unicode(profile), + self.assertEqual(str(profile), "Registration information for alice") def test_activation_email(self): From 7ba61fd1356e2a87c2821d533dfacb2b28baa28c Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 3 Jun 2020 22:07:24 +0500 Subject: [PATCH 06/31] Some more fixes. Has 38 errors --- anytask/admission/tests.py | 2 +- anytask/anycontest/tests.py | 29 ++++++++++--------- anytask/anyrb/tests.py | 4 +-- anytask/anyrb/unpacker.py | 2 +- anytask/api/tests.py | 2 +- anytask/api/views.py | 6 ++-- anytask/courses/tests.py | 25 +++++++++------- anytask/courses/views.py | 5 ++-- anytask/issues/tests.py | 12 ++++---- anytask/mail/tests.py | 22 +++++++------- anytask/tasks/tests.py | 16 +++++----- .../registration/tests/models.py | 2 +- 12 files changed, 66 insertions(+), 61 deletions(-) diff --git a/anytask/admission/tests.py b/anytask/admission/tests.py index 722add71b..31135c540 100644 --- a/anytask/admission/tests.py +++ b/anytask/admission/tests.py @@ -113,7 +113,7 @@ def test_register_activate(self, mock_contest_register): # post register response = client.post(reverse(admission.views.register), post_data, **test_header) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, "OK") + self.assertEqual(response.content, b"OK") registration_profile = AdmissionRegistrationProfile.objects.all() self.assertEqual(len(registration_profile), 1) diff --git a/anytask/anycontest/tests.py b/anytask/anycontest/tests.py index e38c3c674..d78af046e 100644 --- a/anytask/anycontest/tests.py +++ b/anytask/anycontest/tests.py @@ -9,18 +9,18 @@ from tasks.models import Task from issues.models import Issue, File, Event from issues.model_issue_status import IssueStatus -from common import get_contest_info +from .common import get_contest_info from anycontest.models import ContestSubmission from django.core.files.uploadedfile import SimpleUploadedFile from django.utils.translation import ugettext as _ import threading -import BaseHTTPServer -import SocketServer +import http.server as BaseHTTPServer +import socketserver as SocketServer import time import json -import tests_data +from . import tests_data import cgi CONTEST_PORT = 8079 @@ -39,13 +39,14 @@ def do_GET(self): # NOQA if self.path.startswith("/anytask/contest?contestId="): self.send_response(200) self.end_headers() - json.dump(tests_data.CONTEST_INFO, self.wfile) + self.wfile.write(json.dumps(tests_data.CONTEST_INFO).encode('utf8')) return if self.path.startswith("/anytask/problems?contestId="): self.send_response(200) self.end_headers() - json.dump(tests_data.CONTEST_PROBLEMS, self.wfile) + data = json.dumps(tests_data.CONTEST_PROBLEMS).encode('utf8') + self.wfile.write(data) return if self.path == "/anytask/results?runId=1&contestId=0": @@ -59,7 +60,7 @@ def do_GET(self): # NOQA } self.send_response(200) self.end_headers() - json.dump(reply, self.wfile) + self.wfile.write(json.dumps(reply).encode('utf8')) return if self.path == "/anytask/results?runId=2&contestId=0": @@ -78,7 +79,7 @@ def do_GET(self): # NOQA } self.send_response(200) self.end_headers() - json.dump(reply, self.wfile) + self.wfile.write(json.dumps(reply).encode('utf8')) return if self.path == "/anytask/results?runId=3&contestId=0": @@ -105,25 +106,27 @@ def do_GET(self): # NOQA } self.send_response(200) self.end_headers() - json.dump(reply, self.wfile) + self.wfile.write(json.dumps(reply).encode('utf8')) return if self.path == "/anytask/results?runId=5&contestId=0": reply = {"bad_answer": True} self.send_response(200) self.end_headers() - json.dump(reply, self.wfile) + self.wfile.write(json.dumps(reply).encode('utf8')) return self.send_response(501) self.end_headers() def do_POST(self): # NOQA - content_type, pdict = cgi.parse_header(self.headers.getheader("content-type")) + content_type, pdict = cgi.parse_header(self.headers.get("Content-Type")) + pdict['CONTENT-LENGTH'] = int(self.headers.get("Content-Length")) + pdict['boundary'] = pdict['boundary'].encode('ascii') fields = cgi.parse_multipart(self.rfile, pdict) if self.path.startswith("/anytask/submit"): - if "_failed_" in fields["file"][0]: + if b"_failed_" in fields["file"][0]: reply = { 'error': { 'message': "Submit error in fake server!" @@ -138,7 +141,7 @@ def do_POST(self): # NOQA self.send_response(200) self.end_headers() - json.dump(reply, self.wfile) + self.wfile.write(json.dumps(reply).encode('utf8')) return self.send_response(501) diff --git a/anytask/anyrb/tests.py b/anytask/anyrb/tests.py index 6be987592..61ca7612d 100644 --- a/anytask/anyrb/tests.py +++ b/anytask/anyrb/tests.py @@ -1,7 +1,7 @@ import os from django.test import TestCase -from unpacker import UnpackedFile, unpack_files +from .unpacker import UnpackedFile, unpack_files CUR_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_DIR = os.path.join(CUR_DIR, "test_data") @@ -28,7 +28,7 @@ def _test_unpack(self, arcfilename): ] with unpack_files(files) as unpacked_files: - unpacked_filenames = map(lambda x: x.filename(), unpacked_files) + unpacked_filenames = list(map(lambda x: x.filename(), unpacked_files)) self.assertListEqual(['1.txt', arcfilename + '/1.py', arcfilename + '/dir/1.pl'], unpacked_filenames) def test_unpack_zip(self): diff --git a/anytask/anyrb/unpacker.py b/anytask/anyrb/unpacker.py index e35e0bada..3f4409b78 100644 --- a/anytask/anyrb/unpacker.py +++ b/anytask/anyrb/unpacker.py @@ -66,7 +66,7 @@ def unpack_files(files): try: unpacked_filepath = os.path.join(root, unpacked_file) unpacked_filename = unpacked_filepath[len(dst_dir):] - unpacked_filename = unpacked_filename.decode("utf-8", errors="ignore") + unpacked_filename = unpacked_filename unpacked_file = UnpackedFile(unpacked_filepath, f.filename() + unpacked_filename) res.append(unpacked_file) except Exception as e: diff --git a/anytask/api/tests.py b/anytask/api/tests.py index 05105a8c6..55fd0cc56 100644 --- a/anytask/api/tests.py +++ b/anytask/api/tests.py @@ -334,7 +334,7 @@ def test_get_issue(self, username=None, password=None): self.assertDictEqual(issue, response_data) response = self.client.get(url) - self.assertEqual('print "_failed_"', ''.join(response.streaming_content)) + self.assertEqual(b'print "_failed_"', b''.join(response.streaming_content)) def test_get_issue_no_access(self): response = self._request(self.anytask, self.anytask_password, diff --git a/anytask/api/views.py b/anytask/api/views.py index b387e6475..17e79dc55 100644 --- a/anytask/api/views.py +++ b/anytask/api/views.py @@ -76,7 +76,7 @@ def unpack_issue(issue, add_events=False, request=None, lang=settings.API_LANGUA "create_time": issue.create_time.isoformat() + "Z", "update_time": issue.update_time.isoformat() + "Z", "responsible": None, - "followers": map(lambda x: unpack_user(x), issue.followers.all()), + "followers": list(map(lambda x: unpack_user(x), issue.followers.all())), "status": unpack_status(issue.status_field, lang), "student": unpack_user(issue.student), "task": unpack_task(task) @@ -86,7 +86,7 @@ def unpack_issue(issue, add_events=False, request=None, lang=settings.API_LANGUA ret["responsible"] = unpack_user(issue.responsible) if add_events and request: - ret["events"] = map(lambda x: unpack_event(request, x), issue.get_history()) + ret["events"] = list(map(lambda x: unpack_event(request, x), issue.get_history())) return ret @@ -122,7 +122,7 @@ def unpack_event(request, event): "author": unpack_user(event.author), "message": event.get_message(), # "files": list(event.file_set.all()) - "files": map(lambda x: unpack_file(request, x), event.file_set.filter(deleted=False)), + "files": list(map(lambda x: unpack_file(request, x), event.file_set.filter(deleted=False))), } return ret diff --git a/anytask/courses/tests.py b/anytask/courses/tests.py index b6a19098d..bf5d8a604 100644 --- a/anytask/courses/tests.py +++ b/anytask/courses/tests.py @@ -268,8 +268,8 @@ def test_gradebook_with_teacher(self): table_body_rows_cells = table_body_rows[0]('td') self.assertEqual(len(table_body_rows_cells), 4) self.assertEqual(table_body_rows_cells[1].a['href'], u'/users/student/') - self.assertEqual(table_body_rows_cells[1].a.string.strip().strip('\n'), u'student_last_name student_name') - self.assertEqual(table_body_rows_cells[2].string.strip().strip('\n'), u' ') + self.assertEqual(table_body_rows_cells[1].a.string.strip().strip('\n'), u'student_last_name\xa0student_name') + self.assertEqual(table_body_rows_cells[2].string.strip('\n'), u'\xa0') self.assertEqual(table_body_rows_cells[3].span.string.strip().strip('\n'), u'0') def test_queue_page_with_teacher(self): @@ -348,7 +348,7 @@ def test_edit_course_information_with_teacher(self): {'course_id': self.course.id, 'course_information': 'course_information'}) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, '{"info": "
course_information
"}') + self.assertEqual(response.content, b'{"info": "
course_information
"}') # get course page response = client.get(reverse(courses.views.gradebook, kwargs={'course_id': self.course.id})) @@ -468,13 +468,14 @@ def test_change_visibility_hidden_tasks_with_teacher(self): self.assertIsNone(table_head.string) table_body = table.tbody('td')[2] - self.assertEqual(table_body.string.strip().strip('\n'), u' ') + test = table_body.string + self.assertEqual(test.strip('\n'), '\xa0') # post page response = client.post(reverse(courses.views.change_visibility_hidden_tasks), {'course_id': self.course.id}) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, 'OK') + self.assertEqual(response.content, b'OK') # get course page response = client.get(reverse(courses.views.gradebook, kwargs={'course_id': self.course.id})) @@ -559,7 +560,7 @@ def test_set_course_mark_with_teacher(self): 'student_id': self.student.id, 'mark_id': mark_fields[0].id}) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, '{"mark_int": -1, "mark_id": 1, "mark": "mark1"}') + self.assertEqual(response.content, b'{"mark_int": -1, "mark_id": 1, "mark": "mark1"}') # get course page response = client.get(reverse(courses.views.gradebook, kwargs={'course_id': self.course.id})) @@ -651,7 +652,8 @@ def test_set_task_mark_with_teacher(self): 'mark_max': task.score_max, 'mark_value': '3'}) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, '{"color": "' + IssueStatus.objects.get(pk=5).color + '", "mark": 3.0}') + self.assertEqual(response.content, + b'{"color": "' + IssueStatus.objects.get(pk=5).color.encode('utf8') + b'", "mark": 3.0}') # get course page response = client.get(reverse(courses.views.gradebook, kwargs={'course_id': self.course.id})) @@ -750,8 +752,8 @@ def test_gradebook_with_student(self): table_body_rows_cells = table_body_rows[0]('td') self.assertEqual(len(table_body_rows_cells), 4) self.assertEqual(table_body_rows_cells[1].a['href'], u'/users/student/') - self.assertEqual(table_body_rows_cells[1].a.string.strip().strip('\n'), u'student_last_name student_name') - self.assertEqual(table_body_rows_cells[2].string.strip().strip('\n'), u' ') + self.assertEqual(table_body_rows_cells[1].a.string.strip().strip('\n'), u'student_last_name\xa0student_name') + self.assertEqual(table_body_rows_cells[2].string.strip('\n'), u'\xa0') self.assertEqual(table_body_rows_cells[3].span.string.strip().strip('\n'), u'0') def test_queue_page_with_student(self): @@ -861,7 +863,7 @@ def test_set_course_mark_with_student(self): 'student_id': self.student.id, 'mark_id': mark_fields[0].id}) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, '{"mark_int": -1, "mark_id": 1, "mark": "mark1"}') + self.assertEqual(response.content, b'{"mark_int": -1, "mark_id": 1, "mark": "mark1"}') # get course page self.assertTrue(client.login(username=self.student.username, password=self.student_password)) @@ -936,7 +938,8 @@ def test_set_task_mark_with_student(self): 'mark_max': task.score_max, 'mark_value': '3'}) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, '{"color": "' + IssueStatus.objects.get(pk=5).color + '", "mark": 3.0}') + self.assertEqual(response.content, + b'{"color": "' + IssueStatus.objects.get(pk=5).color.encode('utf8') + b'", "mark": 3.0}') # get course page self.assertTrue(client.login(username=self.student.username, password=self.student_password)) diff --git a/anytask/courses/views.py b/anytask/courses/views.py index a7a31f413..ace6ad6e4 100644 --- a/anytask/courses/views.py +++ b/anytask/courses/views.py @@ -714,7 +714,7 @@ def set_course_mark(request): student_course_mark.update_time = datetime.datetime.now() student_course_mark.mark = mark student_course_mark.save() - return HttpResponse(json.dumps({'mark': str(mark), 'mark_id': mark.id, 'mark_int': mark.name_int}), + return HttpResponse(json.dumps({'mark_int': mark.name_int, 'mark_id': mark.id, 'mark': str(mark)}), content_type="application/json") @@ -740,8 +740,7 @@ def set_task_mark(request): issue.set_byname('mark', mark) - return HttpResponse(json.dumps({'mark': mark, - 'color': issue.status_field.color}), + return HttpResponse(json.dumps({'color': issue.status_field.color, 'mark': mark}), content_type="application/json") diff --git a/anytask/issues/tests.py b/anytask/issues/tests.py index 4bfe92fe4..228116bc4 100644 --- a/anytask/issues/tests.py +++ b/anytask/issues/tests.py @@ -70,7 +70,7 @@ def test_issue_create_filled(self): self.assertEqual(issue.mark, 3) self.assertEqual(issue.responsible, responsible) self.assertEqual(issue.status_field, status) - self.assertItemsEqual(issue.followers.all(), followers) + self.assertCountEqual(issue.followers.all(), followers) class ViewsTest(TestCase): @@ -761,7 +761,7 @@ def test_deadline(self): self.assertEqual(len(history), 2, 'History len is not 2') self.assertIsNotNone(history[0].find('div', {'id': 'event_alert'}), 'No info message for deadline') self.assertNotIn('after_deadline', - history[1].find('div', 'history-body')['class'].split(' '), + history[1].find('div', 'history-body')['class'], 'Wrong deadline end comment color') # login via student @@ -786,10 +786,10 @@ def test_deadline(self): self.assertEqual(len(history), 3, 'History len is not 3') self.assertIsNotNone(history[0].find('div', {'id': 'event_alert'}), 'No info messege for deadline') self.assertNotIn('after_deadline', - history[1].find('div', 'history-body')['class'].split(' '), + history[1].find('div', 'history-body')['class'], 'Wrong deadline end comment color') self.assertIn('after_deadline', - history[2].find('div', 'history-body')['class'].split(' '), + history[2].find('div', 'history-body')['class'], 'Wrong deadline end comment color') # check if deadline greater @@ -812,10 +812,10 @@ def test_deadline(self): self.assertEqual(len(history), 2, 'History len is not 2') self.assertIsNone(history[0].find('div', {'id': 'event_alert'}), 'No info messege for deadline') self.assertNotIn('after_deadline', - history[0].find('div', 'history-body')['class'].split(' '), + history[0].find('div', 'history-body')['class'], 'Wrong deadline end comment color') self.assertNotIn('after_deadline', - history[1].find('div', 'history-body')['class'].split(' '), + history[1].find('div', 'history-body')['class'], 'Wrong deadline end comment color') @patch('anyrb.common.AnyRB.upload_review') diff --git a/anytask/mail/tests.py b/anytask/mail/tests.py index 3fb926324..42c59142a 100644 --- a/anytask/mail/tests.py +++ b/anytask/mail/tests.py @@ -55,10 +55,10 @@ def test_message_create_filled(self): self.assertEqual(message.sender, self.sender) self.assertEqual(message.title, u"title") self.assertEqual(message.text, u"text") - self.assertItemsEqual(message.recipients.all(), self.recipients) - self.assertItemsEqual(message.recipients_user.all(), self.recipients) - self.assertItemsEqual(message.recipients_course.all(), self.recipients_course) - self.assertItemsEqual(message.recipients_group.all(), self.recipients_group) + self.assertCountEqual(message.recipients.all(), self.recipients) + self.assertCountEqual(message.recipients_user.all(), self.recipients) + self.assertCountEqual(message.recipients_course.all(), self.recipients_course) + self.assertCountEqual(message.recipients_group.all(), self.recipients_group) class ViewsTest(TestCase): @@ -264,7 +264,7 @@ def test_ajax_send_message_user(self): # get page response = client.post(reverse(mail.views.ajax_send_message), post_data) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, 'OK') + self.assertEqual(response.content, b'OK') # check msg creation messages_count = Message.objects.count() @@ -273,10 +273,10 @@ def test_ajax_send_message_user(self): self.assertEqual(message.sender, self.sender) self.assertEqual(message.title, u"title") self.assertEqual(message.text, u"text") - self.assertItemsEqual(message.recipients.all(), self.recipients) - self.assertItemsEqual(message.recipients_user.all(), self.recipients_user) - self.assertItemsEqual(message.recipients_course.all(), self.recipients_course) - self.assertItemsEqual(message.recipients_group.all(), self.recipients_group) + self.assertCountEqual(message.recipients.all(), self.recipients) + self.assertCountEqual(message.recipients_user.all(), self.recipients_user) + self.assertCountEqual(message.recipients_course.all(), self.recipients_course) + self.assertCountEqual(message.recipients_group.all(), self.recipients_group) # check sent sender get_data = { @@ -364,13 +364,13 @@ def test_message_manipulation(self): # get page response = client.post(reverse(mail.views.ajax_send_message), post_data) self.assertEqual(response.status_code, 200) - self.assertEqual(response.content, 'OK') + self.assertEqual(response.content, b'OK') message = Message.objects.get(id=1) # have unread msg for recipient in message.recipients.all(): - self.assertItemsEqual(recipient.profile.unread_messages.all(), [message]) + self.assertCountEqual(recipient.profile.unread_messages.all(), [message]) # make read get_data = { diff --git a/anytask/tasks/tests.py b/anytask/tasks/tests.py index a4ead334c..8eeca454e 100644 --- a/anytask/tasks/tests.py +++ b/anytask/tasks/tests.py @@ -68,7 +68,7 @@ def test_task_create_filled(self): self.assertIsInstance(task, Task) self.assertEqual(task.title, 'title') self.assertEqual(task.course, course) - self.assertItemsEqual(task.groups.all(), group) + self.assertCountEqual(task.groups.all(), group) self.assertEqual(task.weight, 1) self.assertEqual(task.is_hidden, True) self.assertEqual(task.parent_task, parent_task) @@ -234,14 +234,14 @@ def test_task_create_or_edit_page_with_teacher(self): 'task_text': 'task_text'}) self.assertEqual(response.status_code, 200) self.assertEqual(response.content, - '{"page_title": "task_title | course_name | 2016-2017", "redirect_page": "/task/edit/2"}') + b'{"page_title": "task_title | course_name | 2016-2017", "redirect_page": "/task/edit/2"}') # check created task self.assertEqual(len(Task.objects.all()), 2, 'Must be 2 tasks') created_task = Task.objects.get(id=2) self.assertEqual(created_task.title, 'task_title', 'Created task wrong title') self.assertEqual(created_task.course, self.course, 'Created task wrong course') - self.assertItemsEqual(created_task.groups.all(), [self.group], 'Created task wrong group') + self.assertCountEqual(created_task.groups.all(), [self.group], 'Created task wrong group') self.assertEqual(created_task.is_hidden, True, 'Created task wrong is_hidden') self.assertIsNone(created_task.parent_task, 'Created task wrong parent_task') self.assertEqual(created_task.task_text, 'task_text', 'Created task wrong task_text') @@ -343,7 +343,7 @@ def test_task_create_or_edit_page_with_teacher(self): response = client.post(reverse(courses.views.change_visibility_hidden_tasks), {'course_id': self.course.id}) self.assertEqual(response.status_code, 200, "Can't get change_visibility_hidden_tasks via teacher") - self.assertEqual(response.content, 'OK') + self.assertEqual(response.content, b'OK') response = client.get(reverse(courses.views.gradebook, kwargs={'course_id': self.course.id})) self.assertEqual(response.status_code, 200, "Can't get course_page via teacher") @@ -362,7 +362,7 @@ def test_task_create_or_edit_page_with_teacher(self): '/issue/get_or_create/1/2', 'Wrong link to issue in table for 1st task') self.assertEqual(table_body.span.string.strip().strip('\n'), '0', 'Wrong mark in table for 1st task') - self.assertIn('no-issue', table_body.span['class'].split(' '), "No 'no-issue' class in table for 1st task") + self.assertIn('no-issue', table_body.span['class'], "No 'no-issue' class in table for 1st task") table_head = table.thead('th')[3] self.assertEqual(table_head.a.string.strip().strip('\n'), 'task_title', 'Wrong title 2nd task') @@ -442,7 +442,7 @@ def test_import_contest(self, mock_get_contest_info): response = client.post(reverse(tasks.views.contest_task_import), post_data) self.assertEqual(response.status_code, 200, "Can't get get_contest_info via teacher") self.assertEqual(response.content, - '{"is_error": true, "error": "net_prav_na_kontest"}', + b'{"is_error": true, "error": "net_prav_na_kontest"}', 'Wrong response text') # get contest_task_import page with unknown error @@ -454,7 +454,7 @@ def test_import_contest(self, mock_get_contest_info): mock_get_contest_info.return_value = (True, {'problems': problems}) response = client.post(reverse(tasks.views.contest_task_import), post_data) self.assertEqual(response.status_code, 200, "Can't get get_contest_info via teacher") - self.assertEqual(response.content, 'OK', 'Wrong response text') + self.assertEqual(response.content, b'OK', 'Wrong response text') tasks = Task.objects.exclude(id=1) self.assertEqual(len(tasks), 2, 'Wrong number of tasks') @@ -462,7 +462,7 @@ def test_import_contest(self, mock_get_contest_info): for idx, task in enumerate(tasks): self.assertEqual(task.title, problems[problems_idx]['problemTitle'], 'Wrong task title') self.assertEqual(task.course, self.course) - self.assertItemsEqual(task.groups.all(), [self.group]) + self.assertCountEqual(task.groups.all(), [self.group]) self.assertEqual(task.is_hidden, True) self.assertIsNone(task.parent_task) self.assertEqual(task.task_text, problems[problems_idx]['statement']) diff --git a/dependencies/django-registration/registration/tests/models.py b/dependencies/django-registration/registration/tests/models.py index 64f402a6c..1ca291b32 100644 --- a/dependencies/django-registration/registration/tests/models.py +++ b/dependencies/django-registration/registration/tests/models.py @@ -183,7 +183,7 @@ def test_activation_nonexistent_key(self): """ # Due to the way activation keys are constructed during # registration, this will never be a valid key. - invalid_key = sha_constructor('foo').hexdigest() + invalid_key = sha_constructor(b'foo').hexdigest() self.failIf(RegistrationProfile.objects.activate_user(invalid_key)) def test_expired_user_deletion(self): From ffde73e5bebdcd108d68943ee0f15ed14124bad9 Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 3 Jun 2020 23:12:52 +0500 Subject: [PATCH 07/31] 25 Errrrrors --- .../django-registration/registration/tests/backends.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dependencies/django-registration/registration/tests/backends.py b/dependencies/django-registration/registration/tests/backends.py index f13cc52dd..e1b748647 100644 --- a/dependencies/django-registration/registration/tests/backends.py +++ b/dependencies/django-registration/registration/tests/backends.py @@ -34,7 +34,7 @@ def request(self, **request): """ environ = { - 'HTTP_COOKIE': self.cookies, + 'HTTP_COOKIE': str(self.cookies), 'PATH_INFO': '/', 'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', @@ -43,16 +43,17 @@ def request(self, **request): 'SERVER_NAME': 'testserver', 'SERVER_PORT': '80', 'SERVER_PROTOCOL': 'HTTP/1.1', - 'wsgi.version': (1,0), + 'wsgi.version': (1, 0), 'wsgi.url_scheme': 'http', 'wsgi.errors': self.errors, - 'wsgi.multiprocess':True, + 'wsgi.multiprocess': True, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.input': None, } environ.update(self.defaults) environ.update(request) + request = WSGIRequest(environ) # We have to manually add a session since we'll be bypassing From f7a8e36c896fc8e890b3eab15f1f89305caa33af Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 12 Jun 2020 12:43:39 +0500 Subject: [PATCH 08/31] 18 errors --- anytask/tasks/templatetags/sanitize_html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anytask/tasks/templatetags/sanitize_html.py b/anytask/tasks/templatetags/sanitize_html.py index 4b0323627..a01abb2d7 100644 --- a/anytask/tasks/templatetags/sanitize_html.py +++ b/anytask/tasks/templatetags/sanitize_html.py @@ -14,7 +14,7 @@ def sanitize_html(value): if not value: return '' - soup = BeautifulSoup(value) + soup = BeautifulSoup(value, features="html.parser") if not (soup.find('div', 'not-sanitize')): for comment in soup.findAll(text=lambda text: isinstance(text, Comment)): From 5e700fd2ab16da1ffbb5bd6d136d423bc0eb4757 Mon Sep 17 00:00:00 2001 From: Sergey Date: Fri, 12 Jun 2020 16:19:22 +0500 Subject: [PATCH 09/31] Change django-registration version. Now 7 errors --- anytask/templates/base.html | 6 +- .../registration/activation_complete.html | 2 +- .../registration/password_reset_complete.html | 2 +- .../registration/password_reset_email.html | 2 +- .../registration/password_reset_email.txt | 2 +- .../registration/registration_form.html | 2 +- anytask/users/tests.py | 9 +- .../.hg_archival.txt | 0 .../.hgignore | 0 .../.hgtags | 0 .../django-registration(restore)/AUTHORS | 36 + .../django-registration(restore)/CHANGELOG | 239 ++++ .../INSTALL | 0 .../django-registration(restore)/LICENSE | 28 + .../django-registration(restore)/MANIFEST.in | 8 + .../README | 0 .../docs/Makefile | 88 ++ .../docs/backend-api.rst | 0 .../django-registration(restore)/docs/conf.py | 194 +++ .../docs/default-backend.rst | 239 ++++ .../django-registration(restore)/docs/faq.rst | 195 +++ .../docs/forms.rst | 100 ++ .../docs/index.rst | 55 + .../docs/make.bat | 112 ++ .../docs/quickstart.rst | 294 +++++ .../docs/release-notes.rst | 69 + .../docs/signals.rst | 56 + .../docs/simple-backend.rst | 61 + .../docs/upgrade.rst | 118 ++ .../docs/views.rst | 122 ++ .../registration/__init__.py | 30 + .../registration/admin.py | 46 + .../registration/auth_urls.py | 57 + .../registration/backends/__init__.py | 32 + .../registration/backends/default/__init__.py | 136 ++ .../registration/backends/default/urls.py | 51 + .../backends/default_with_names/__init__.py | 306 +++++ .../backends/default_with_names/urls.py | 83 ++ .../registration/backends/simple/__init__.py | 64 + .../registration/backends/simple/urls.py | 34 + .../registration/forms.py | 123 ++ .../locale/ar/LC_MESSAGES/django.po | 81 ++ .../locale/bg/LC_MESSAGES/django.po | 78 ++ .../locale/ca/LC_MESSAGES/django.po | 97 ++ .../locale/cs/LC_MESSAGES/django.po | 94 ++ .../locale/da/LC_MESSAGES/django.po | 92 ++ .../locale/de/LC_MESSAGES/django.po | 93 ++ .../locale/el/LC_MESSAGES/django.po | 84 ++ .../locale/en/LC_MESSAGES/django.po | 137 ++ .../locale/es/LC_MESSAGES/django.po | 85 ++ .../locale/es_AR/LC_MESSAGES/django.po | 83 ++ .../locale/fa/LC_MESSAGES/django.po | 80 ++ .../locale/fr/LC_MESSAGES/django.po | 91 ++ .../locale/he/LC_MESSAGES/django.po | 86 ++ .../locale/hr/LC_MESSAGES/django.po | 86 ++ .../locale/is/LC_MESSAGES/django.po | 74 ++ .../locale/it/LC_MESSAGES/django.po | 89 ++ .../locale/ja/LC_MESSAGES/django.po | 78 ++ .../locale/ko/LC_MESSAGES/django.po | 89 ++ .../locale/nb/LC_MESSAGES/django.po | 91 ++ .../locale/nl/LC_MESSAGES/django.po | 77 ++ .../locale/pl/LC_MESSAGES/django.po | 84 ++ .../locale/pt/LC_MESSAGES/django.po | 88 ++ .../locale/pt_BR/LC_MESSAGES/django.po | 81 ++ .../locale/ru/LC_MESSAGES/django.po | 92 ++ .../locale/sl/LC_MESSAGES/django.po | 87 ++ .../locale/sr/LC_MESSAGES/django.po | 80 ++ .../locale/sv/LC_MESSAGES/django.po | 81 ++ .../locale/tr_TR/LC_MESSAGES/django.po | 92 ++ .../locale/zh_CN/LC_MESSAGES/django.po | 77 ++ .../locale/zh_TW/LC_MESSAGES/django.po | 77 ++ .../registration/management/__init__.py | 0 .../management/commands/__init__.py | 0 .../commands/cleanupregistration.py | 19 + .../registration/migrations/0001_initial.py | 31 + .../registration/migrations/__init__.py | 0 .../registration/models.py | 262 ++++ .../registration/signals.py | 8 + .../registration/tests/__init__.py | 8 + .../registration/tests/backends.py | 0 .../registration/tests/forms.py | 121 ++ .../registration/tests/models.py | 225 ++++ .../registration/tests/urls.py | 88 ++ .../registration/tests/views.py | 0 .../registration/urls.py | 0 .../registration/views.py | 229 ++++ .../django-registration(restore)/setup.py | 48 + dependencies/django-registration/.coveragerc | 16 + dependencies/django-registration/.gitignore | 63 + dependencies/django-registration/.travis.yml | 20 + dependencies/django-registration/AUTHORS | 11 +- dependencies/django-registration/CHANGELOG | 290 ++++- dependencies/django-registration/LICENSE | 4 +- dependencies/django-registration/MANIFEST.in | 4 +- dependencies/django-registration/Makefile | 37 + dependencies/django-registration/README.rst | 110 ++ .../docs/admin-approval-backend.rst | 42 + dependencies/django-registration/docs/conf.py | 20 +- .../docs/default-backend.rst | 121 +- dependencies/django-registration/docs/faq.rst | 138 +- .../django-registration/docs/forms.rst | 39 +- .../django-registration/docs/index.rst | 45 +- .../django-registration/docs/quickstart.rst | 292 +++-- .../docs/release-notes.rst | 66 +- .../django-registration/docs/signals.rst | 8 +- .../docs/simple-backend.rst | 37 +- .../django-registration/docs/upgrade.rst | 231 ++-- .../django-registration/docs/views.rst | 243 ++-- dependencies/django-registration/manage.py | 10 + .../registration/__init__.py | 30 +- .../django-registration/registration/admin.py | 31 +- .../registration/auth_urls.py | 68 +- .../registration/backends/__init__.py | 32 - .../backends/admin_approval/__init__.py | 0 .../backends/admin_approval/urls.py | 77 ++ .../backends/admin_approval/views.py | 72 ++ .../registration/backends/default/__init__.py | 136 -- .../registration/backends/default/urls.py | 76 +- .../registration/backends/default/views.py | 180 +++ .../backends/default_with_names/__init__.py | 4 +- .../backends/default_with_names/urls.py | 50 +- .../backends/default_with_names/views.py | 202 +++ .../registration/backends/simple/__init__.py | 64 - .../registration/backends/simple/urls.py | 41 +- .../registration/backends/simple/views.py | 46 + .../django-registration/registration/forms.py | 105 +- .../locale/ar/LC_MESSAGES/django.po | 434 ++++++- .../locale/bg/LC_MESSAGES/django.po | 438 ++++++- .../locale/ca/LC_MESSAGES/django.po | 412 +++++- .../locale/cs/LC_MESSAGES/django.po | 426 ++++++- .../locale/da/LC_MESSAGES/django.po | 429 ++++++- .../locale/de/LC_MESSAGES/django.po | 508 +++++++- .../locale/el/LC_MESSAGES/django.po | 460 ++++++- .../locale/en/LC_MESSAGES/django.po | 402 +++++- .../locale/es/LC_MESSAGES/django.po | 492 +++++++- .../locale/es_AR/LC_MESSAGES/django.po | 437 ++++++- .../locale/fa/LC_MESSAGES/django.po | 436 ++++++- .../locale/fr/LC_MESSAGES/django.po | 523 +++++++- .../locale/he/LC_MESSAGES/django.po | 436 ++++++- .../locale/hr/LC_MESSAGES/django.po | 439 ++++++- .../locale/hu/LC_MESSAGES/django.po | 478 +++++++ .../locale/is/LC_MESSAGES/django.po | 425 ++++++- .../locale/it/LC_MESSAGES/django.po | 434 ++++++- .../locale/ja/LC_MESSAGES/django.po | 443 ++++++- .../locale/ko/LC_MESSAGES/django.po | 424 ++++++- .../locale/nb/LC_MESSAGES/django.po | 430 ++++++- .../locale/nl/LC_MESSAGES/django.po | 449 ++++++- .../locale/pl/LC_MESSAGES/django.po | 427 ++++++- .../locale/pt/LC_MESSAGES/django.po | 427 ++++++- .../locale/pt_BR/LC_MESSAGES/django.po | 474 ++++++- .../locale/ru/LC_MESSAGES/django.po | 459 ++++++- .../locale/sl/LC_MESSAGES/django.po | 433 ++++++- .../locale/sr/LC_MESSAGES/django.po | 446 ++++++- .../locale/sv/LC_MESSAGES/django.po | 427 ++++++- .../locale/th/LC_MESSAGES/django.po | 503 ++++++++ .../locale/tr_TR/LC_MESSAGES/django.po | 419 ++++++- .../locale/zh_CN/LC_MESSAGES/django.po | 434 ++++++- .../locale/zh_TW/LC_MESSAGES/django.po | 434 ++++++- .../commands/cleanupregistration.py | 10 +- .../registration/migrations/0001_initial.py | 14 +- .../0002_registrationprofile_activated.py | 20 + .../0003_migrate_activatedstatus.py | 31 + .../0004_supervisedregistrationprofile.py | 29 + .../migrations/0005_activation_key_sha256.py | 20 + .../registration/models.py | 679 ++++++++-- .../registration/signals.py | 18 + .../registration/tests/__init__.py | 11 +- .../registration/tests/admin_actions.py | 70 ++ .../tests/admin_approval_backend.py | 117 ++ .../registration/tests/default_backend.py | 254 ++++ .../registration/tests/forms.py | 89 +- .../registration/tests/forms_custom_user.py | 50 + .../registration/tests/models.py | 1112 +++++++++++++++-- .../registration/tests/simple_backend.py | 86 ++ .../registration/tests/urls.py | 137 +- .../django-registration/registration/users.py | 15 + .../django-registration/registration/utils.py | 6 + .../django-registration/registration/views.py | 327 ++--- .../django-registration/requirements.txt | 5 + dependencies/django-registration/setup.cfg | 15 + dependencies/django-registration/setup.py | 98 +- dependencies/django-registration/tasks.py | 30 + .../django-registration/test-requirements.txt | 8 + .../django-registration/test_app/__init__.py | 1 + .../django-registration/test_app/models.py | 12 + .../django-registration/test_app/settings.py | 61 + .../test_app/settings_test.py | 64 + .../test_app/templates/base.html | 38 + .../test_app/templates/index.html | 7 + .../test_app/templates/profile.html | 7 + .../test_app/urls_admin_approval.py | 28 + .../test_app/urls_default.py | 28 + .../test_app/urls_simple.py | 28 + dependencies/django-registration/tox.ini | 31 + 194 files changed, 24802 insertions(+), 2697 deletions(-) rename dependencies/{django-registration => django-registration(restore)}/.hg_archival.txt (100%) rename dependencies/{django-registration => django-registration(restore)}/.hgignore (100%) rename dependencies/{django-registration => django-registration(restore)}/.hgtags (100%) create mode 100644 dependencies/django-registration(restore)/AUTHORS create mode 100644 dependencies/django-registration(restore)/CHANGELOG rename dependencies/{django-registration => django-registration(restore)}/INSTALL (100%) create mode 100644 dependencies/django-registration(restore)/LICENSE create mode 100644 dependencies/django-registration(restore)/MANIFEST.in rename dependencies/{django-registration => django-registration(restore)}/README (100%) create mode 100644 dependencies/django-registration(restore)/docs/Makefile rename dependencies/{django-registration => django-registration(restore)}/docs/backend-api.rst (100%) create mode 100644 dependencies/django-registration(restore)/docs/conf.py create mode 100644 dependencies/django-registration(restore)/docs/default-backend.rst create mode 100644 dependencies/django-registration(restore)/docs/faq.rst create mode 100644 dependencies/django-registration(restore)/docs/forms.rst create mode 100644 dependencies/django-registration(restore)/docs/index.rst create mode 100644 dependencies/django-registration(restore)/docs/make.bat create mode 100644 dependencies/django-registration(restore)/docs/quickstart.rst create mode 100644 dependencies/django-registration(restore)/docs/release-notes.rst create mode 100644 dependencies/django-registration(restore)/docs/signals.rst create mode 100644 dependencies/django-registration(restore)/docs/simple-backend.rst create mode 100644 dependencies/django-registration(restore)/docs/upgrade.rst create mode 100644 dependencies/django-registration(restore)/docs/views.rst create mode 100644 dependencies/django-registration(restore)/registration/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/admin.py create mode 100644 dependencies/django-registration(restore)/registration/auth_urls.py create mode 100644 dependencies/django-registration(restore)/registration/backends/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/backends/default/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/backends/default/urls.py create mode 100644 dependencies/django-registration(restore)/registration/backends/default_with_names/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/backends/default_with_names/urls.py create mode 100644 dependencies/django-registration(restore)/registration/backends/simple/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/backends/simple/urls.py create mode 100644 dependencies/django-registration(restore)/registration/forms.py create mode 100644 dependencies/django-registration(restore)/registration/locale/ar/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/bg/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/ca/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/cs/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/da/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/de/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/el/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/en/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/es/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/es_AR/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/fa/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/fr/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/he/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/hr/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/is/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/it/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/ja/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/ko/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/nb/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/nl/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/pl/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/pt/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/pt_BR/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/ru/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/sl/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/sr/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/sv/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/tr_TR/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/zh_CN/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/locale/zh_TW/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration(restore)/registration/management/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/management/commands/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/management/commands/cleanupregistration.py create mode 100644 dependencies/django-registration(restore)/registration/migrations/0001_initial.py create mode 100644 dependencies/django-registration(restore)/registration/migrations/__init__.py create mode 100644 dependencies/django-registration(restore)/registration/models.py create mode 100644 dependencies/django-registration(restore)/registration/signals.py create mode 100644 dependencies/django-registration(restore)/registration/tests/__init__.py rename dependencies/{django-registration => django-registration(restore)}/registration/tests/backends.py (100%) create mode 100644 dependencies/django-registration(restore)/registration/tests/forms.py create mode 100644 dependencies/django-registration(restore)/registration/tests/models.py create mode 100644 dependencies/django-registration(restore)/registration/tests/urls.py rename dependencies/{django-registration => django-registration(restore)}/registration/tests/views.py (100%) rename dependencies/{django-registration => django-registration(restore)}/registration/urls.py (100%) create mode 100644 dependencies/django-registration(restore)/registration/views.py create mode 100644 dependencies/django-registration(restore)/setup.py create mode 100644 dependencies/django-registration/.coveragerc create mode 100644 dependencies/django-registration/.gitignore create mode 100644 dependencies/django-registration/.travis.yml create mode 100644 dependencies/django-registration/Makefile create mode 100644 dependencies/django-registration/README.rst create mode 100644 dependencies/django-registration/docs/admin-approval-backend.rst create mode 100644 dependencies/django-registration/manage.py create mode 100644 dependencies/django-registration/registration/backends/admin_approval/__init__.py create mode 100644 dependencies/django-registration/registration/backends/admin_approval/urls.py create mode 100644 dependencies/django-registration/registration/backends/admin_approval/views.py create mode 100644 dependencies/django-registration/registration/backends/default/views.py create mode 100644 dependencies/django-registration/registration/backends/default_with_names/views.py create mode 100644 dependencies/django-registration/registration/backends/simple/views.py create mode 100644 dependencies/django-registration/registration/locale/hu/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration/registration/locale/th/LC_MESSAGES/django.po create mode 100644 dependencies/django-registration/registration/migrations/0002_registrationprofile_activated.py create mode 100644 dependencies/django-registration/registration/migrations/0003_migrate_activatedstatus.py create mode 100644 dependencies/django-registration/registration/migrations/0004_supervisedregistrationprofile.py create mode 100644 dependencies/django-registration/registration/migrations/0005_activation_key_sha256.py create mode 100644 dependencies/django-registration/registration/tests/admin_actions.py create mode 100644 dependencies/django-registration/registration/tests/admin_approval_backend.py create mode 100644 dependencies/django-registration/registration/tests/default_backend.py create mode 100644 dependencies/django-registration/registration/tests/forms_custom_user.py create mode 100644 dependencies/django-registration/registration/tests/simple_backend.py create mode 100644 dependencies/django-registration/registration/users.py create mode 100644 dependencies/django-registration/registration/utils.py create mode 100644 dependencies/django-registration/requirements.txt create mode 100644 dependencies/django-registration/setup.cfg create mode 100644 dependencies/django-registration/tasks.py create mode 100644 dependencies/django-registration/test-requirements.txt create mode 100644 dependencies/django-registration/test_app/__init__.py create mode 100644 dependencies/django-registration/test_app/models.py create mode 100644 dependencies/django-registration/test_app/settings.py create mode 100644 dependencies/django-registration/test_app/settings_test.py create mode 100644 dependencies/django-registration/test_app/templates/base.html create mode 100644 dependencies/django-registration/test_app/templates/index.html create mode 100644 dependencies/django-registration/test_app/templates/profile.html create mode 100644 dependencies/django-registration/test_app/urls_admin_approval.py create mode 100644 dependencies/django-registration/test_app/urls_default.py create mode 100644 dependencies/django-registration/test_app/urls_simple.py create mode 100644 dependencies/django-registration/tox.ini diff --git a/anytask/templates/base.html b/anytask/templates/base.html index 610ef85fe..e6667cd13 100644 --- a/anytask/templates/base.html +++ b/anytask/templates/base.html @@ -709,16 +709,16 @@