Add support for twitter cards (full image viewer only) (rebased onto metadata52)#4613
Conversation
Rename property as omero.web.sharing.twitter to provide a namespace for other sharing options.
|
--rebased-from #4260 |
| """ | ||
|
|
||
| server_id = request.session['connector'].server_id | ||
| server_name = Server.get(server_id).server |
There was a problem hiding this comment.
Something (I haven't been able to find what) changed in omeroweb which means Server._registry is empty, so Server.get(server_id) returns None instead of an object.
cc @aleksandra-tarkowska
There was a problem hiding this comment.
2016-05-12 21:07:28,464 DEBUG [ omero.gateway.utils] (proc.56823) setOmeroShare():163 Key 'omero.share' not found in <ServiceOptsDict: {'omero.session.uuid': '7066138f-cd75-408f-b913-d62b833fb2ff', 'omero.group': '-1', 'omero.client.uuid': 'ad442d36-7712-46cf-9e23-dcc59062c28d'}>
2016-05-12 21:07:28,465 DEBUG [ omeroweb.webgateway.views] (proc.56823) full_viewer():1946 server_id 1
2016-05-12 21:07:28,465 DEBUG [ omeroweb.webgateway.views] (proc.56823) full_viewer():1948 server_name: omero
your PR works for me
(tested with development server, gunicorn throws exception as stated)
There was a problem hiding this comment.
@manics FastCGI used manage.py to start workers, wsgi uses different application handler, where settings are not imported. if you remove https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroWeb/omeroweb/manage.py#L38 it will fail with exactly the same error.
There was a problem hiding this comment.
Thanks for the sleuthing, @aleksandra-tarkowska
|
|
| from omero.util.decorators import timeit, TimeIt | ||
| from omeroweb.http import HttpJavascriptResponse, HttpJsonResponse, \ | ||
| HttpJavascriptResponseServerError | ||
| from connector import Server |
There was a problem hiding this comment.
could you try from omeroweb.connector import Server ?
I am guessing you copied that over from settings.py. if you want to load that list from within a nested dir you need to give a full path, see webadmin https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroWeb/omeroweb/webadmin/forms.py#L35
|
Thanks @aleksandra-tarkowska , I've added your fix and it works for me now. |
|
|
||
| if hasattr(settings, 'SHARING_OPENGRAPH'): | ||
| opengraph = settings.SHARING_OPENGRAPH.get(server_name) | ||
| logger.debug('Open Graph enabled: %s', twitter) |
|
Tested with Kelli. Merging for IDR-0.0.5 |
|
--rebased-to #5216 |
This is the same as gh-4260 but rebased onto metadata52.
I've had this lurking around since January 2014. Given that we now have a public resource and Twitter no longer require manual approvals I thought it's time to resurrect it. See https://dev.twitter.com/cards/types/summary-large-image
The
titleanddescriptionfields are mandatory, I'm assuming there will always be a non-empty image name, description is set to the owner's name if empty.At risk of stating the obvious this can only be tested with a public image on an external server. Open an image in the full image viewer, copy the url into a tweet.