Skip to content

Add support for twitter cards (full image viewer only) (rebased onto metadata52)#4613

Merged
joshmoore merged 7 commits intoome:metadata52from
manics:rebased/metadata52/twittercards
Jun 8, 2016
Merged

Add support for twitter cards (full image viewer only) (rebased onto metadata52)#4613
joshmoore merged 7 commits intoome:metadata52from
manics:rebased/metadata52/twittercards

Conversation

@manics
Copy link
Copy Markdown
Member

@manics manics commented Apr 26, 2016

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 title and description fields 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.

@manics
Copy link
Copy Markdown
Member Author

manics commented Apr 26, 2016

--rebased-from #4260

"""

server_id = request.session['connector'].server_id
server_name = Server.get(server_id).server
Copy link
Copy Markdown
Member Author

@manics manics May 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

@atarkowska atarkowska May 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the sleuthing, @aleksandra-tarkowska

@manics
Copy link
Copy Markdown
Member Author

manics commented May 12, 2016

Exclude until someone can figure out what's changed between 5.1 and 5.2

from omero.util.decorators import timeit, TimeIt
from omeroweb.http import HttpJavascriptResponse, HttpJsonResponse, \
HttpJavascriptResponseServerError
from connector import Server
Copy link
Copy Markdown
Member

@atarkowska atarkowska May 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@manics
Copy link
Copy Markdown
Member Author

manics commented May 13, 2016

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/twitter/opengraph/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@joshmoore
Copy link
Copy Markdown
Member

Tested with Kelli. Merging for IDR-0.0.5

@manics
Copy link
Copy Markdown
Member Author

manics commented Aug 19, 2016

Note #4792 is only a partial rebase of #4744. If this PR is rebased to develop the remaining changes from #4744 will be required.

@manics manics deleted the rebased/metadata52/twittercards branch December 13, 2016 16:50
@atarkowska
Copy link
Copy Markdown
Member

--rebased-to #5216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants