Skip to content

Commit

Permalink
Revert "moved previewable types to os.environ"
Browse files Browse the repository at this point in the history
This reverts commit 8e48daf.
  • Loading branch information
domoritz committed Nov 30, 2012
1 parent 8e48daf commit 9a784f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 0 additions & 4 deletions ckan/config/environment.py
Expand Up @@ -343,10 +343,6 @@ def genshi_lookup_attr(cls, obj, key):
if not model.meta.engine:
model.init_model(engine)

# set which data types can be previewed natively
os.environ['DIRECT_EMBEDS'] = 'png, jpg, gif'
os.environ['LOADABLE'] = '''html, htm, rdf+xml, owl+xml, xml,
n3, n-triples, turtle, plain, atom, tsv, rss, txt, json'''

for plugin in p.PluginImplementations(p.IConfigurable):
plugin.configure(config)
10 changes: 7 additions & 3 deletions ckan/lib/helpers.py
Expand Up @@ -14,7 +14,6 @@
import copy
from urllib import urlencode
import urlparse
import os

from paste.deploy.converters import asbool
from webhelpers.html import escape, HTML, literal, url_escape
Expand Down Expand Up @@ -1316,6 +1315,11 @@ def resource_preview(resource, pkg_id):
embeds a web page, recline or a pdf preview.
'''

DIRECT_EMBEDS = ['png', 'jpg', 'gif']
LOADABLE = ['html', 'htm', 'rdf+xml', 'owl+xml', 'xml', 'n3',
'n-triples', 'turtle', 'plain', 'atom', 'tsv', 'rss',
'txt', 'json']

format_lower = resource['format'].lower()
directly = False
url = ''
Expand All @@ -1334,10 +1338,10 @@ def resource_preview(resource, pkg_id):
if _can_be_previewed(data_dict):
url = url_for(controller='package', action='resource_datapreview',
resource_id=resource['id'], id=pkg_id, qualified=True)
elif format_lower in os.environ.get('DIRECT_EMBEDS').split(','):
elif format_lower in DIRECT_EMBEDS:
directly = True
url = resource['url']
elif format_lower in os.environ.get('LOADABLE').split(','):
elif format_lower in LOADABLE:
url = resource['url']
else:
log.info('No preview handler for resource type {0}'.format(format_lower))
Expand Down

0 comments on commit 9a784f4

Please sign in to comment.