#28923 closed Bug (wontfix)
"TypeError: 'set' object is not reversible" crash if form Media is a set rather than list/tuple
Reported by: | Edwar Baron | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 2.0 |
Severity: | Release blocker | Keywords: | reversed |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I have updated the version of Django to 2.0 in an existing project, and I have followed all the steps necessary for the project to be compatible.
but I'm having problems in the administrator when creating or editing a model that uses attributes from this django-markdownx library
the current configuration of the project of the usa packages:
amqp (2.2.2) apipkg (1.4) asn1crypto (0.23.0) attrs (17.3.0) Babel (2.5.1) bcrypt (3.1.4) billiard (3.5.0.3) celery (4.1.0) certifi (2017.11.5) cffi (1.11.2) chardet (3.0.4) coreapi (2.3.3) coreschema (0.0.4) coverage (4.4.2) cryptography (2.1.4) Django (2.0) django-celery-results (1.0.1) django-colorfield (0.1.14) django-constance (2.0.0) django-cors-headers (2.1.0) django-environ (0.4.4) django-excel-response (2.0.2) django-extensions (1.9.8) django-filter (1.1.0) django-markdownx (2.0.21) django-picklefield (1.0.0) django-redis (4.8.0) django-redis-cache (1.7.1) django-rest-swagger (2.1.2) djangorestframework (3.7.3) et-xmlfile (1.0.1) execnet (1.5.0) Fabric3 (1.13.1.post1) factory-boy (2.7.0) fake-factory (0.7.4) flower (0.9.2) idna (2.6) isort (4.2.15) itypes (1.1.0) jdcal (1.3) Jinja2 (2.10) kombu (4.1.0) Markdown (2.6.10) MarkupSafe (1.0) olefile (0.44) opbeat (3.6.0) openapi-codec (1.3.2) openpyxl (2.4.9) paramiko (2.4.0) pep8 (1.7.1) Pillow (4.3.0) pip (9.0.1) pluggy (0.6.0) psycopg2 (2.7.3.2) py (1.5.2) pyasn1 (0.4.2) pycparser (2.18) pyflakes (1.6.0) PyNaCl (1.2.1) pytest (3.3.1) pytest-cache (1.0) pytest-cov (2.5.1) pytest-django (3.1.2) pytest-flakes (2.0.0) pytest-isort (0.1.0) pytest-pep8 (1.0.6) pytest-sugar (0.9.0) python-dateutil (2.6.1) pytz (2017.3) redis (2.10.6) requests (2.18.4) setuptools (36.4.0) simplejson (3.13.2) six (1.11.0) sorl-thumbnail (12.4.1) termcolor (1.1.0) tornado (4.5.2) typing (3.6.2) uritemplate (3.0.0) urllib3 (1.22) vine (1.1.4) Werkzeug (0.13) wheel (0.30.0)
the error is caused in this file
File "/usr/local/lib/python3.6/site-packages/django/forms/widgets.py", line 114, in merge ... combined_list = list(list_1) last_insert_index = len(list_1) # Walk list_2 in reverse, inserting each element into combined_list if # it doesn't already exist. for path in reversed(list_2): TypeError: 'set' object is not reversible ... Local variables in frame last_insert_index 0 combined_list [] list_2 set(['markdownx/js/markdownx.js']) list_1 []
the variable list_2 is a list of set type
the simple solution that I think
is to convert that variable to a list
Attachments (1)
Change History (4)
by , 7 years ago
Attachment: | Screenshot from 2017-12-13 22-24-17.png added |
---|
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 by , 7 years ago
Summary: | TypeError: 'set' object is not reversible → "TypeError: 'set' object is not reversible" crash if form Media is a set rather than list/tuple |
---|
Note:
See TracTickets
for help on using tickets.
I think that naively converting an unordered collection to an arbitrarily ordered one will cause more harm than good here as this might change the ordering of static files inclusions between Python interpreter launches (given
PYTHONHASHSEED=random
which is the default value on Python versions supported by Django 2.0) or generate hard to reproduce warningsThe third-party library should make sure to pass an ordered collection to
Media.merge
as hinted by the raisedTypeError
.