Opened 13 years ago

Last modified 8 years ago

#382 in_progress defect

If video support is turned off after videos have been uploaded, videos are still shown and cause an error when clicked

Reported by: Clint Byrum Owned by: Ben Sturmfels
Priority: minor Milestone:
Component: programming Keywords: bitesized decision
Cc: ben@… Parent Tickets:

Description (last modified by Christopher Allan Webber)

Test case:

Install mediagoblin with video turned on in
mediagoblin_local.ini:

media_types = mediagoblin.media\_types.image,
mediagoblin.media_types.video

Upload a video

Change mediagoblin_local.ini to have

media_types = mediagoblin.media_types.image,

Restart paster / lazyserver / celery / etc.

The video will be displayed, click it, you will get an error:

Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: Error -
<class 'mediagoblin.media_types.FileTypeNotSupported'>:
MediaManager not in enabled types. Check media_types in config?
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: URL:
`http://ec2-107-20-7-95.compute-1.amazonaws.com/u/s22/m/some-video/ <http://ec2-107-20-7-95.compute-1.amazonaws.com/u/s22/m/some-video/>`_
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File
'/opt/mediagoblin/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/exceptions/errormiddleware.py',
line 144 in *call*
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: app_iter
= self.application(environ, sr_checker)
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File
'/opt/mediagoblin/local/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/urlmap.py',
line 203 in *call*
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: return
app(environ, start_response)
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File
'/opt/mediagoblin/local/lib/python2.7/site-packages/Beaker-1.6.2-py2.7.egg/beaker/middleware.py',
line 155 in *call*
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: return
self.wrap_app(environ, session_start_response)
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File
'/opt/mediagoblin/mediagoblin/app.py', line 176 in *call*
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: response =
controller(request)
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File
'/opt/mediagoblin/mediagoblin/decorators.py', line 117 in wrapper
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: return
controller(request, media=media, **args,**kwargs)
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File
'/opt/mediagoblin/mediagoblin/decorators.py', line 83 in wrapper
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: return
controller(request, page=page,
*args, **kwargs)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File '/opt/mediagoblin/mediagoblin/user_pages/views.py', line 125 in media_homeJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: media_template_name = get_media_manager(media.media_type)['display_template']Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File '/opt/mediagoblin/mediagoblin/media_types/**init**.py', line 65 in get_media_managerJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: "MediaManager not in enabled types. Check media_types in config?")Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: FileTypeNotSupported: MediaManager not in enabled types. Check media_types in config?Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi:Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi:Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: CGI VariablesJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: -------------Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: CSRF_TOKEN: u'2991456393146439023'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: DOCUMENT_ROOT: '/etc/nginx/html'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: DOCUMENT_URI: '/u/s22/m/some-video/'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: GATEWAY_INTERFACE: 'CGI/1.1'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,**/*;q=0.8'
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi:
HTTP_ACCEPT_CHARSET:
'ISO-8859-1,utf-8;q=0.7,*;q=0.3'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_ACCEPT_ENCODING: 'gzip,deflate,sdch'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_ACCEPT_LANGUAGE: 'en-US,en;q=0.8'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_CONNECTION: 'keep-alive'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_COOKIE: 'mediagoblin_csrftoken=2991456393146439023; mediagoblin_csrftoken=2991456393146439023; mediagoblin_csrftoken=2991456393146439023'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_HOST: 'ec2-107-20-7-95.compute-1.amazonaws.com'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_REFERER: 'http://ec2-107-20-7-95.compute-1.amazonaws.com/'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: HTTP_USER_AGENT: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: PATH_INFO: '/u/s22/m/some-video/'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: REDIRECT_STATUS: '200'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: REMOTE_ADDR: '76.94.215.209'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: REMOTE_PORT: '41472'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: REQUEST_METHOD: 'GET'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: REQUEST_URI: '/u/s22/m/some-video/'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: SCRIPT_FILENAME: '/etc/nginx/html/u/s22/m/some-video/'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: SERVER_ADDR: '10.215.83.225'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: SERVER_PORT: '80'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: SERVER_PROTOCOL: 'HTTP/1.1'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: SERVER_SOFTWARE: 'nginx/1.0.5'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi:Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi:Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: WSGI VariablesJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: --------------Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: application: {(None, '/mgoblin_media'): <StaticURLParser '/opt/mediagoblin/user_dev/media/public'>, (None, '/mgoblin_static'): <StaticURLParser '/opt/mediagoblin/mediagoblin/static'>, (None, ''): <beaker.middleware.SessionMiddleware object at 0xa5bf54c>}Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: beaker.get_session: <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0xa5bf54c>>Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: beaker.session: {'_accessed_time': 1327450884.558526, '_creation_time': 1327450884.558526}Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: paste.throw_errors: TrueJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: webob._parsed_cookies: ({'mediagoblin_csrftoken': '2991456393146439023'}, 'mediagoblin_csrftoken=2991456393146439023; mediagoblin_csrftoken=2991456393146439023; mediagoblin_csrftoken=2991456393146439023')Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: webob._parsed_query_vars: (GET, '')Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: webob.adhoc_attrs: {'locale': 'en_US', 'staticdirect': <mediagoblin.staticdirect.RemoteStaticDirect object at 0xa5bf68c>, 'app': <mediagoblin.app.MediaGoblinApp object at 0xa55dbcc>, 'db': Database(Connection('localhost', 27017), u'mediagoblin'), 'urlgen': <routes.util.URLGenerator object at 0xa5ba14c>, 'start_response': <function session_start_response at 0xa6221ec>, 'session': {'_accessed_time': 1327450884.558526, '_creation_time': 1327450884.558526}, 'full_path': '/u/s22/m/some-video/', 'template_env': <jinja2.environment.Environment object at 0xa623eec>, 'matchdict': {'media': u'some-video', 'controller': u'mediagoblin.user_pages.views:media_home', 'user': u's22'}, 'user': None}Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: wsgi process: 'Multiprocess'Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: ------------------------------------------------------------Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: Starting server in PID 24618.Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: Traceback (most recent call last):Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/bin/paster", line 9, in Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 104, in runJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: invoke(command, command_name, options, args[1:])Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 143, in invokeJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: exit_code = runner.run(args)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py", line 238, in runJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: result = self.command()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/serve.py", line 311, in commandJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: serve()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/local/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/serve.py", line 295, in serveJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: server(app)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 189, in server_wrapperJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi:**context.local_conf)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/opt/mediagoblin/local/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_callJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: val = callable(*args,
**kw)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/paste_factory.py", line 94, in run_fcgi_forkJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: s.run()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_fork.py", line 133, in runJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: ret = PreforkServer.run(self, sock)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/preforkserver.py", line 123, in runJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: if not self._spawnChild(sock): breakJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/preforkserver.py", line 296, in _spawnChildJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._child(sock, parent)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/preforkserver.py", line 374, in _childJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._jobClass(clientSock, addr,*self._jobArgs).run()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 646, in runJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self.process_input()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 682, in process_inputJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._do_params(rec)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 781, in _do_paramsJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._start_request(req)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 765, in _start_requestJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: req.run()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 571, in runJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._flush()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 582, in _flushJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self.stderr.close()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 334, in closeJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self.flush()Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 328, in flushJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._write(data)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 299, in _writeJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._conn.writeRecord(rec)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 697, in writeRecordJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: rec.write(self._sock)Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File "/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 534, in writeJan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: self._sendall(sock, '00'*self.paddingLength)
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: File
"/usr/lib/pymodules/python2.7/flup/server/fcgi_base.py", line 507,
in _sendall
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi: sent =
sock.send(data)
Jan 25 00:21:24 domU-12-31-39-0C-50-13 mediagoblin.fcgi:
socket.error: [Errno 104] Connection reset by peer

This was as of this commit:

commit c47a03b909ecd97cab5b144d0cab007b62b92a90
Author: Elrond
<`elrond+mediagoblin.org@samba-tng.org <mailto:elrond+mediagoblin.org@samba-tng.org>`_>
Date: Wed Jan 4 22:13:19 2012 +0100

    Proper url_to_{prev,next} for SQL
    
    Uses complete sqlalchemy syntax now.

Grabbed via:

    git clone git://gitorious.org/mediagoblin/mediagoblin.git

Attachments (2)

traceback-video-disabled.txt (1.6 KB ) - added by Ben Sturmfels 11 years ago.
Updated traceback running on development server.
0001-Add-note-on-disabling-media-types-Related-382.patch (1.3 KB ) - added by Jorge 8 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by Will Kahn-Greene, 13 years ago

The original url for this bug was http://bugs.foocorp.net/issues/745 .

comment:2 by Elrond, 12 years ago

Component: programming
Description: modified (diff)
Keywords: bitesized decision added

bitesized task: Try to reproduce this on current master and see what is happening. We need a current stack trace.

Not so simple task: We need to decide what should happen in the general case anyway: Should we just not show "not any more supported" media? Or a striped version? I really don't know.

(I don't know, why trac thinks I modified the description. I did not intend to.)

comment:3 by Christopher Allan Webber, 12 years ago

Description: modified (diff)

by Ben Sturmfels, 11 years ago

Updated traceback running on development server.

comment:4 by Ben Sturmfels, 11 years ago

Cc: ben@… added

I've added an updated traceback repeating this on the current master. The list view displays ok, but the attached error occurs when attempting to view the individual page for a video.

I'd be happy to do some work on this, but a design decision is needed. How should non-supported media items be treated in list views, and how should they be treated on individual pages?

This situation should only ever arise for system administrators and the error message clearly describes the problem:

FileTypeNotSupported: MediaManager not in enabled types.  Check media_types in config?

One approach could be just to give administrators a management (shell) command to purge unsupported media. It should probably confirm what will be purged before it actually happens.

comment:5 by Ben Sturmfels, 10 years ago

It seems to me that once a media type is disabled, items of that type should no longer show in list view. The details view should probably return HTTP 404 with content "[media_type] files are not enabled on this server."

I'm happy to attack this change if someone can confirm that this approach would be ok.

comment:6 by Ben Sturmfels, 9 years ago

Owner: set to Ben Sturmfels
Status: acceptedin_progress

in reply to:  5 ; comment:7 by ayleph, 9 years ago

Replying to Sturm:

It seems to me that once a media type is disabled, items of that type should no longer show in list view. The details view should probably return HTTP 404 with content "[media_type] files are not enabled on this server."

I'm not sure I agree with that approach. I don't really like the idea of hiding already-uploaded content (but hiding it is certainly better than auto-deleting it).

If my site has a lot of videos, and then I realize I don't have space for any more videos, or something happens and I can no longer transcode videos properly, I'd like a way to prevent further videos from being uploaded without affecting existing videos.

Maybe a compromise would be to add an additional config directive for each media type to enable/disable uploads of that media type. So if I want to allow video uploads, I could do something like:

[[mediagoblin.media_types.video]]
allow_upload = True #(default to true, so no need to explicitly add this line)

And if I want to keep existing videos but prevent more videos from being uploaded I could do:

[[mediagoblin.media_types.video]]
allow_upload = False

And then if I want to disable video all together I could remove the video media_type directive and then maybe we just hide the existing videos like Sturm suggests.

It would be also be worthwhile to check into whether bin/gmg dbupdate can complete successfully when videos exist in the database but the video media type is disabled.

in reply to:  7 ; comment:8 by Ben Sturmfels, 9 years ago

Replying to ayleph:

I don't really like the idea of hiding already-uploaded content (but hiding it is certainly better than auto-deleting it).

If my site has a lot of videos, and then I realize I don't have space for any more videos, or something happens and I can no longer transcode videos properly, I'd like a way to prevent further videos from being uploaded without affecting existing videos.

Enabling/disabling uploads for a media type would be useful feature. Could you please add a separate ticket for that? This ticket is specifically about gracefully handling a media type plugin being entirely disabled, and we'll need that regardless of whether we can disable uploads or not.

Once a media type plugin is disabled, MediaGoblin doesn't actually know how to display that type of media at all. It is possible to still display some general information about the piece of media; such as title, description, author, license and date; but not the media itself. Perhaps we could still list the item and allow people to visit its detail page with some basic information, but display a message to say that the media itself cannot be displayed as it's type is unknown?

It would be also be worthwhile to check into whether bin/gmg dbupdate can complete successfully when videos exist in the database but the video media type is disabled.

Good thinking. I'll check that too. :)

in reply to:  8 comment:9 by ayleph, 9 years ago

Replying to Sturm:

Enabling/disabling uploads for a media type would be useful feature. Could you please add a separate ticket for that? This ticket is specifically about gracefully handling a media type plugin being entirely disabled, and we'll need that regardless of whether we can disable uploads or not.

I created #5392 to introduce the idea of disabling further uploads of an already-configured media type.

Once a media type plugin is disabled, MediaGoblin doesn't actually know how to display that type of media at all. It is possible to still display some general information about the piece of media; such as title, description, author, license and date; but not the media itself. Perhaps we could still list the item and allow people to visit its detail page with some basic information, but display a message to say that the media itself cannot be displayed as it's type is unknown?

I like that idea better than throwing server errors or hiding the media from list view.

comment:10 by Jorge, 8 years ago

related issues

  • #5392 Add ability to disable uploads of media type while retaining existing media of that type
  • #472 option to use uploaded audio/video file “as is”, without transcoding

This issue persists in 0.9.0. A current stacktrace from stable:

  1. comment "mediagoblin.media_types.video" in mediagoblin_local.ini
  2. run ./bin/gmg dbupdate
$ ./bin/gmg dbupdate                                                                                                                     
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.                                                                                                            
INFO  [alembic.runtime.migration] Will assume transactional DDL.                                                                                                          
Traceback (most recent call last):                                                                                                          
  File "./bin/gmg", line 11, in <module>                                                                                                         
    load_entry_point('mediagoblin', 'console_scripts', 'gmg')()                                                                         
  File "/srv/mediagoblin.latest/mediagoblin/gmg_commands/__init__.py", line 148, inmain_cli                                                    
    args.func(args)                                                                                                                               
  File "/srv/mediagoblin.latest/mediagoblin/gmg_commands/dbupdate.py", line 234, indbupdate                                   
    run_dbupdate(app_config, global_config)                                      
  File "/srv/mediagoblin.latest/mediagoblin/gmg_commands/dbupdate.py", line 165, inrun_dbupdate                                         
    run_alembic_migrations(db, app_config, global_config)
  File "/srv/mediagoblin.latest/mediagoblin/gmg_commands/dbupdate.py", line 136, inrun_alembic_migrations
    return command.upgrade(cfg, 'heads')
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/command.py", line 174, in upgrade
    script.run_env()
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/base.py", line 416, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/util/pyfiles.py", line 93, in load_python_file
    module = load_module_py(module_id, path)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/util/compat.py", line 79, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "/srv/mediagoblin.latest/mediagoblin/db/migrations/env.py", line 63, in <module>
    run_migrations_online()
  File "/srv/mediagoblin.latest/mediagoblin/db/migrations/env.py", line 58, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/runtime/environment.py", line 807, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/runtime/migration.py", line 312, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/command.py", line 163, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/base.py", line 333, in _upgrade_revs
    for script in reversed(list(revs))
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/base.py", line 169, in _catch_revision_errors
    compat.raise_from_cause(util.CommandError(resolution))
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/util/compat.py", line 132, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/base.py", line 138, in _catch_revision_errors
    yield
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/base.py", line 329, in _upgrade_revs
    revs = list(revs)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/revision.py", line 641, in _iterate_revisions
    requested_lowers = self.get_revisions(lower)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/revision.py", line 298, in get_revisions
    return sum([self.get_revisions(id_elem) for id_elem in id_], ())
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/revision.py", line 303, in get_revisions
    for rev_id in resolved_id)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/revision.py", line 303, in <genexpr>
    for rev_id in resolved_id)
  File "/srv/mediagoblin.latest/lib/python2.7/site-packages/alembic-0.8.10-py2.7.egg/alembic/script/revision.py", line 358, in _revision_for_ident
    resolved_id)
alembic.util.exc.CommandError: Can't locate revision identified by '38feb829c545'
  1. run service mediagoblin-paster restart as root and reload mg in the browser

/var/log/mediagoblin/paster.log

Error - <class 'mediagoblin.media_types.FileTypeNotSupported'>: MediaManager not in enabled types. Check media_type plugins are enabled in config?

browser:

Module paste.exceptions.errormiddleware:142 in __call__
>>  app_iter = self.application(environ, sr_checker)
Module mediagoblin.app:342 in __call__
>>  return self.call_backend(environ, start_response)
Module werkzeug.wsgi:599 in __call__
>>  return self.app(environ, start_response)
Module mediagoblin.app:276 in call_backend
>>  return self._finish_call_backend(request, environ, start_response)
Module mediagoblin.app:318 in _finish_call_backend
>>  response = controller(request)
Module mediagoblin.views:46 in root_view
>>  return view(request)
Module mediagoblin.decorators:47 in wrapper
>>  return controller(request, *args, **kwargs)
Module mediagoblin.decorators:170 in wrapper
>>  return controller(request, page=page, *args, **kwargs)
Module mediagoblin.views:37 in default_root_view
>>  'pagination': pagination})
Module mediagoblin.tools.response:36 in render_to_response
>>  render_template(request, template, context),
Module mediagoblin.tools.template:144 in render_template
>>  rendered = template.render(context)
Module jinja2.environment:989 in render
>>  return self.environment.handle_exception(exc_info, True)
Module jinja2.environment:754 in handle_exception
>>  reraise(exc_type, exc_value, tb)
Module /srv/mediagoblin/mediagoblin/templates/mediagoblin/root.html:22 in top-level template code
>>  {% set feed_url = request.urlgen('mediagoblin.listings.atom_feed') %}
Module /srv/mediagoblin/mediagoblin/templates/mediagoblin/base.html:67 in top-level template code
>>  {% block mediagoblin_body %}
Module /srv/mediagoblin/mediagoblin/templates/mediagoblin/base.html:195 in block "mediagoblin_body"
>>  {% block mediagoblin_content %}
Module /srv/mediagoblin/mediagoblin/templates/mediagoblin/root.html:33 in block "mediagoblin_content"
>>  {{ object_gallery(request, media_entries, pagination) }}
Module /srv/mediagoblin/mediagoblin/templates/mediagoblin/utils/object_gallery.html:62 in template
>>  {{ media_grid(request, media_entries, col_number=col_number) }}
Module /srv/mediagoblin/mediagoblin/templates/mediagoblin/utils/object_gallery.html:33 in template
>>  {% if entry.icon_url %}
Module jinja2.environment:408 in getattr
>>  return getattr(obj, attribute)
Module mediagoblin.db.mixin:309 in icon_url
>>  self.media_manager['type_icon'])
Module werkzeug.utils:73 in __get__
>>  value = self.func(obj)
Module mediagoblin.db.mixin:325 in media_manager
>>  "MediaManager not in enabled types. Check media_type plugins are"
FileTypeNotSupported: MediaManager not in enabled types. Check media_type plugins are enabled in config?
Note: See TracTickets for help on using tickets.