[Django] #28923: TypeError: 'set' object is not reversible

185 views
Skip to first unread message

Django

unread,
Dec 13, 2017, 10:44:40 PM12/13/17
to django-...@googlegroups.com
#28923: TypeError: 'set' object is not reversible
-------------------------------------------+--------------------------
Reporter: Edwar Baron | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
Severity: Release blocker | Keywords: reversed
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+--------------------------
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, or that the function **reversed**,
support that **set** type of data

--
Ticket URL: <https://code.djangoproject.com/ticket/28923>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 13, 2017, 10:44:57 PM12/13/17
to django-...@googlegroups.com
#28923: TypeError: 'set' object is not reversible
---------------------------------+--------------------------------------

Reporter: Edwar Baron | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
Severity: Release blocker | Resolution:

Keywords: reversed | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Edwar Baron):

* Attachment "Screenshot from 2017-12-13 22-24-17.png" added.

Django

unread,
Dec 13, 2017, 10:48:42 PM12/13/17
to django-...@googlegroups.com
#28923: TypeError: 'set' object is not reversible
---------------------------------+--------------------------------------

Reporter: Edwar Baron | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 2.0
Severity: Release blocker | Resolution:

Keywords: reversed | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by Edwar Baron:

Old description:

New description:

Local variables in frame

is to convert that variable to a **list**

--

--
Ticket URL: <https://code.djangoproject.com/ticket/28923#comment:1>

Django

unread,
Dec 14, 2017, 2:15:06 AM12/14/17
to django-...@googlegroups.com
#28923: TypeError: 'set' object is not reversible
---------------------------------+--------------------------------------

Reporter: Edwar Baron | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 2.0
Severity: Release blocker | Resolution: wontfix

Keywords: reversed | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Simon Charette):

* status: new => closed
* resolution: => wontfix


Comment:

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
[https://github.com/django/django/blob/6fd6d8383f48ea2fe4e058725fa30529a083e9a5/django/forms/widgets.py#L123-L127
generate hard to reproduce warnings]

The third-party library should make sure to pass an ordered collection to
`Media.merge` as hinted by the raised `TypeError`.

--
Ticket URL: <https://code.djangoproject.com/ticket/28923#comment:2>

Django

unread,
Dec 15, 2017, 3:32:48 PM12/15/17
to django-...@googlegroups.com
#28923: "TypeError: 'set' object is not reversible" crash if form Media is a set
rather than list/tuple
---------------------------------+--------------------------------------

Reporter: Edwar Baron | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 2.0
Severity: Release blocker | Resolution: wontfix

Keywords: reversed | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/28923#comment:3>

Reply all
Reply to author
Forward
0 new messages