Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/okfn/ckan
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjones committed Jun 21, 2012
2 parents 14a8a59 + 2bf1d3d commit fb86d64
Show file tree
Hide file tree
Showing 10 changed files with 448 additions and 154 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.txt
@@ -1,6 +1,26 @@
CKAN CHANGELOG
++++++++++++++

v1.7.1 2012-06-20
=================

Minor:
* Documentation enhancements regarding install and extensions (#2505)
* Home page and search results speed improvements (#2402,#2403)
* I18n: Added Greek translation and updated other ones (#2506)

Bug fixes:
* UI fixes (#2507)
* Fixes for i18n login and logout issues (#2497)
* Date on add/edit resource breaks if offset is specified (#2383)
* Fix in organizations read page (#2509)
* Add synchronous_search plugin to deployment.ini template (#2521)
* Inconsistent language on license dropdown (#2575)
* Fix bug in translating lists in multilingual plugin
* Group autocomplete doesn't work with multiple words (#2373)
* Other minor fixes


v1.7 2012-05-09
===============

Expand Down
84 changes: 84 additions & 0 deletions ckan/config/environment.py
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Pylons environment configuration"""
import os
import logging
Expand Down Expand Up @@ -176,6 +177,89 @@ def template_loaded(template):
config['pylons.app_globals'].genshi_loader = TemplateLoader(
template_paths, auto_reload=True, callback=template_loaded)

#################################################################
# #
# HORRIBLE GENSHI HACK #
# #
#################################################################
# #
# Genshi does strange things to get stuff out of the template #
# variables. This stops it from handling properties in the #
# correct way as it returns the property rather than the actual #
# value of the property. #
# #
# By overriding lookup_attr() in the LookupBase class we are #
# able to get the required behaviour. Using @property allows #
# us to move functionality out of templates whilst maintaining #
# backwards compatability. #
# #
#################################################################



'''
This code is based on Genshi code
Copyright © 2006-2012 Edgewall Software
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'''
from genshi.template.eval import LookupBase

@classmethod
def genshi_lookup_attr(cls, obj, key):
__traceback_hide__ = True
try:
val = getattr(obj, key)
except AttributeError:
if hasattr(obj.__class__, key):
raise
else:
try:
val = obj[key]
except (KeyError, TypeError):
val = cls.undefined(key, owner=obj)
if isinstance(val, property):
val = val.fget()
return val

setattr(LookupBase, 'lookup_attr', genshi_lookup_attr)
del genshi_lookup_attr
del LookupBase

#################################################################
# #
# END OF GENSHI HACK #
# #
#################################################################

# CONFIGURATION OPTIONS HERE (note: all config options will override
# any Pylons config options)

Expand Down

0 comments on commit fb86d64

Please sign in to comment.