Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#5570 closed defect (fixed)

Adding Collections - Prevents Adding Media under Python 3.5

Reported by: JigmeDatse Owned by:
Priority: major Milestone:
Component: programming Keywords:
Cc: Parent Tickets:

Description

I am in the process of setting up a new instance of MediaGoblin, and have been making some progress, but in trying to figure out why my media would not show up, I "created collection" and then tried to add new media, which results in the error:

Traceback (most recent call last):

File "./mediagoblin/app.py", line 342, in call

return self.call_backend(environ, start_response)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/Werkzeug-0.14.1-py3.5.egg/werkzeug/wsgi.py", line 766, in call

return self.app(environ, start_response)

File "./mediagoblin/app.py", line 276, in call_backend

return self._finish_call_backend(request, environ, start_response)

File "./mediagoblin/app.py", line 318, in _finish_call_backend

response = controller(request)

File "./mediagoblin/decorators.py", line 47, in wrapper

return controller(request, *args, kwargs)

File "./mediagoblin/decorators.py", line 74, in new_controller_func

return controller(request, *args, kwargs)

File "./mediagoblin/decorators.py", line 47, in wrapper

return controller(request, *args, kwargs)

File "./mediagoblin/decorators.py", line 74, in new_controller_func

return controller(request, *args, kwargs)

File "./mediagoblin/decorators.py", line 103, in wrapper

return controller(request, *args, kwargs)

File "./mediagoblin/submit/views.py", line 120, in submit_start

'app_config': mg_globals.app_config})

File "./mediagoblin/tools/response.py", line 36, in render_to_response

render_template(request, template, context),

File "./mediagoblin/tools/template.py", line 144, in render_template

rendered = template.render(context)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/Jinja2-2.10-py3.5.egg/jinja2/environment.py", line 1008, in render

return self.environment.handle_exception(exc_info, True)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/Jinja2-2.10-py3.5.egg/jinja2/environment.py", line 780, in handle_exception

reraise(exc_type, exc_value, tb)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/Jinja2-2.10-py3.5.egg/jinja2/_compat.py", line 37, in reraise

raise value.with_traceback(tb)

File "./mediagoblin/templates/mediagoblin/submit/start.html", line 20, in top-level template code

{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}

File "./mediagoblin/templates/mediagoblin/base.html", line 67, in top-level template code

{% block mediagoblin_body %}

File "./mediagoblin/templates/mediagoblin/base.html", line 195, in block "mediagoblin_body"

{% block mediagoblin_content %}

File "./mediagoblin/templates/mediagoblin/submit/start.html", line 36, in block "mediagoblin_content"

{{ wtforms_util.render_divs(submit_form) }}

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/Jinja2-2.10-py3.5.egg/jinja2/runtime.py", line 579, in _invoke

rv = self._func(*arguments)

File "./mediagoblin/templates/mediagoblin/utils/wtforms.html", line 65, in template

{{ render_field_div(field) }}

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/Jinja2-2.10-py3.5.egg/jinja2/runtime.py", line 579, in _invoke

rv = self._func(*arguments)

File "./mediagoblin/templates/mediagoblin/utils/wtforms.html", line 45, in template

{{ field }}

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/fields/core.py", line 137, in html

return self()

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/fields/core.py", line 153, in call

return self.meta.render_field(self, kwargs)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/meta.py", line 56, in render_field

return field.widget(field, render_kw)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/widgets/core.py", line 287, in call

for val, label, selected in field.iter_choices():

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/ext/sqlalchemy/fields.py", line 107, in iter_choices

for pk, obj in self._get_object_list():

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/ext/sqlalchemy/fields.py", line 100, in _get_object_list

self._object_list = list((text_type(get_pk(obj)), obj) for obj in query)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/ext/sqlalchemy/fields.py", line 100, in <genexpr>

self._object_list = list((text_type(get_pk(obj)), obj) for obj in query)

File "/srv/mediagoblin.example.org/mediagoblin/lib/python3.5/site-packages/WTForms-2.1-py3.5.egg/wtforms/ext/sqlalchemy/fields.py", line 189, in get_pk_from_identity

cls, key = identity_key(instance=obj)

ValueError: too many values to unpack (expected 2)
[pid: 5849|app: 0|req: 48/48] 192.252.228.120 () {46 vars in 931 bytes} [Mon Apr 30 11:03:34 2018] GET /submit/ => generated 0 bytes in 78 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

Change History (6)

comment:1 by Boris Bobrov, 6 years ago

fixed in both master and stable

comment:2 by Boris Bobrov, 6 years ago

Resolution: fixed
Status: newclosed

p.s. this needs to be revisited when https://github.com/wtforms/wtforms/issues/373 is fixed

comment:3 by JigmeDatse, 6 years ago

I'm not sure if I haven't successfully pulled the fix here, or what is going on, but I am still getting the same error. At least when working from the bottom up. I'll look at it later, I'm currently taking a break from this, as I want to get a few other things done before the end of the day. Thanks for all the help.

in reply to:  3 comment:4 by Boris Bobrov, 6 years ago

Replying to JigmeDatse:

I'm not sure if I haven't successfully pulled the fix here, or what is going on, but I am still getting the same error. At least when working from the bottom up. I'll look at it later, I'm currently taking a break from this, as I want to get a few other things done before the end of the day. Thanks for all the help.

You need to downgrade sqlalchemy to version <1.2 manually, unfortunately.

comment:5 by Boris Bobrov, 6 years ago

it can be done like this:

./bin/pip install 'sqlalchemy<1.2'

in reply to:  2 comment:6 by ayleph, 6 years ago

Replying to Boris Bobrov:

p.s. this needs to be revisited when https://github.com/wtforms/wtforms/issues/373 is fixed

Looks like WTForms 2.2 is out now, presumably containing this fix.

Note: See TracTickets for help on using tickets.