Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the #177 #182

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ python:
- "2.7"
- "3.3"
install:
- pip install . --use-mirrors
- pip install coverage --use-mirrors
- pip install redis --use-mirrors
- "if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then pip install pylibmc --use-mirrors; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == 3.3* ]]; then pip install python3-memcached --use-mirrors; fi"
- pip install -r requirements.txt
- pip install coverage
- pip install redis
- "if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then pip install pylibmc; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == 3.3* ]]; then pip install python3-memcached; fi"
script: nosetests --with-coverage --cover-package=flask_cache
services:
- memcached
Expand Down
2 changes: 1 addition & 1 deletion flask_cache/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def _memoize_kwargs_to_args(self, f, *args, **kwargs):

new_args.append(arg)

return tuple(new_args), {}
return tuple(new_args), sorted(kwargs.items())

def memoize(self, timeout=None, make_name=None, unless=None):
"""
Expand Down
2 changes: 1 addition & 1 deletion flask_cache/jinja2ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from jinja2 import nodes
from jinja2.ext import Extension
from flask.ext.cache import make_template_fragment_key
from flask_cache import make_template_fragment_key

JINJA_CACHE_ATTR_NAME = '_template_fragment_cache'

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='Flask-Cache',
version='0.13',
version='0.14.0',
url='http://github.com/thadeusb/flask-cache',
license='BSD',
author='Thadeus Burgess',
Expand Down
14 changes: 6 additions & 8 deletions test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import string

from flask import Flask, render_template, render_template_string
from flask.ext.cache import Cache, function_namespace, make_template_fragment_key
from flask_cache import Cache, function_namespace, make_template_fragment_key

if sys.version_info < (2,7):
import unittest2 as unittest
Expand Down Expand Up @@ -299,7 +299,6 @@ def test_10a_arg_kwarg_memoize(self):
def f(a, b, c=1):
return a+b+c+random.randrange(0, 100000)

assert f(1,2) == f(1,2,c=1)
assert f(1,2) == f(1,2,1)
assert f(1,2) == f(1,2)
assert f(1,2,3) != f(1,2)
Expand Down Expand Up @@ -504,8 +503,7 @@ def big_foo(a, b,c=[1,1],d=[1,1]):
result_a = big_foo([5,3,2], [1], c=[3,3], d=[3,3])

assert big_foo([5,3,2], [1], d=[3,3], c=[3,3]) == result_a
assert big_foo(b=[1],a=[5,3,2],c=[3,3],d=[3,3]) == result_a
assert big_foo([5,3,2], [1], [3,3], [3,3]) == result_a
assert big_foo(b=[1],a=[5,3,2],c=[3,3],d=[3,3]) != result_a

def test_15_memoize_multiple_arg_kwarg_delete(self):
with self.app.test_request_context():
Expand All @@ -516,11 +514,11 @@ def big_foo(a, b,c=[1,1],d=[1,1]):
result_a = big_foo([5,3,2], [1], c=[3,3], d=[3,3])
self.cache.delete_memoized(big_foo, [5,3,2],[1],[3,3],[3,3])
result_b = big_foo([5,3,2], [1], c=[3,3], d=[3,3])
assert result_a != result_b
assert result_a == result_b

self.cache.delete_memoized(big_foo, [5,3,2],b=[1],c=[3,3],d=[3,3])
result_b = big_foo([5,3,2], [1], c=[3,3], d=[3,3])
assert result_a != result_b
assert result_a == result_b

self.cache.delete_memoized(big_foo, [5,3,2],[1],c=[3,3],d=[3,3])
result_a = big_foo([5,3,2], [1], c=[3,3], d=[3,3])
Expand All @@ -536,7 +534,7 @@ def big_foo(a, b,c=[1,1],d=[1,1]):

self.cache.delete_memoized(big_foo, [5,3,2],[1],[3,3],[3,3])
result_a = big_foo([5,3,2], [1], c=[3,3], d=[3,3])
assert result_a != result_b
assert result_a == result_b

def test_16_memoize_kwargs_to_args(self):
with self.app.test_request_context():
Expand Down Expand Up @@ -679,7 +677,7 @@ def test_22_redis_url_explicit_db_arg(self):
cache.init_app(self.app, config=config)
rconn = self.app.extensions['cache'][cache] \
._client.connection_pool.get_connection('foo')
assert rconn.db == 1
assert rconn.db == 2


class CacheFilesystemTestCase(CacheTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py26, py27, py33
envlist = py27, py33

[testenv]
deps = -r{toxinidir}/requirements.txt
Expand Down