rpms/python-beaker/devel python-beaker-middleware-config.patch, NONE, 1.1 python-beaker.spec, 1.13, 1.14

Kyle VanderBeek kylev at fedoraproject.org
Wed Jul 22 02:05:06 UTC 2009


Author: kylev

Update of /cvs/pkgs/rpms/python-beaker/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27297

Modified Files:
	python-beaker.spec 
Added Files:
	python-beaker-middleware-config.patch 
Log Message:
Add upstream patch that fixes accidental config defaults overwriting

python-beaker-middleware-config.patch:
 middleware.py |   11 +++++++----
 util.py       |    9 ++++++---
 2 files changed, 13 insertions(+), 7 deletions(-)

--- NEW FILE python-beaker-middleware-config.patch ---
# HG changeset patch -- Bitbucket.org
# Project beaker
# URL http://bitbucket.org/bbangert/beaker/overview/
# User Ben Bangert <ben at groovie.org>
# Date 1245698939 25200
# Node ID 403ef7c82d328c7c0057cde5510a387d830e1595
# Parent 9d0c12f93b4d65771e243fd96e81b40e137843cd
* Fixed bug with CacheMiddleware overwriting configuration with default
  arguments despite prior setting.

--- a/beaker/util.py
+++ b/beaker/util.py
@@ -304,12 +304,15 @@ def coerce_cache_params(params):
     return verify_rules(params, rules)
 
 
-def parse_cache_config_options(config):
+def parse_cache_config_options(config, include_defaults=True):
     """Parse configuration options and validate for use with the
     CacheManager"""
     # Load default cache options
-    options= dict(type='memory', data_dir=None, expire=None, 
-                       log_file=None)
+    if include_defaults:
+        options= dict(type='memory', data_dir=None, expire=None, 
+                           log_file=None)
+    else:
+        options = {}
     for key, val in config.iteritems():
         if key.startswith('beaker.cache.'):
             options[key[13:]] = val

--- a/beaker/middleware.py
+++ b/beaker/middleware.py
@@ -47,11 +47,14 @@ class CacheMiddleware(object):
         
         self.options = {}
         
-        # Pull out any config args starting with beaker cache. if there are any
-        for dct in [config, kwargs]:
-            parsed_opts = parse_cache_config_options(dct)
-            self.options.update(parsed_opts)
+        # Update the options with the parsed config
+        self.options.update(parse_cache_config_options(config))
         
+        # Add any options from kwargs, but leave out the defaults this
+        # time
+        self.options.update(
+            parse_cache_config_options(kwargs, include_defaults=False))
+                
         # Assume all keys are intended for cache if none are prefixed with
         # 'cache.'
         if not self.options and config:



Index: python-beaker.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-beaker/devel/python-beaker.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -r1.13 -r1.14
--- python-beaker.spec	27 Jun 2009 22:06:43 -0000	1.13
+++ python-beaker.spec	22 Jul 2009 02:05:06 -0000	1.14
@@ -2,7 +2,7 @@
 
 Name: python-beaker
 Version: 1.3.1
-Release: 4%{?dist}
+Release: 5%{?dist}
 Summary: WSGI middleware layer to provide sessions
 
 Group: Development/Languages
@@ -14,6 +14,7 @@ BuildArch: noarch
 BuildRequires: python-setuptools-devel
 Patch0: beaker-hmac2.4.patch
 Patch1: %{name}-absimport.patch
+Patch2: %{name}-middleware-config.patch
 
 %description
 Beaker is a caching library that includes Session and Cache objects built on
@@ -25,6 +26,7 @@ manage Session objects and signed cookie
 %setup -q -n Beaker-%{version}
 %patch0 -p1 -b .hashlib
 %patch1 -p0 -b .absimport
+%patch2 -p1 -b .middleconfig
 
 
 %build
@@ -48,6 +50,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue Jul 21 2009 Kyle VanderBeek <kylev at kylev.com> - 1.3.1-5
+- Add patch based on upstream hg 403ef7c82d32 for config overwriting that
+  breaks Pylons unit tests
+
 * Sat Jun 27 2009 Luke Macken <lmacken at redhat.com> - 1.3.1-4
 - Add a patch to remove the use of __future__.absolute_import in the google
   backend




More information about the fedora-extras-commits mailing list