Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #14 from thekad/master

memcache plugin version bump + pep8
  • Loading branch information...
commit 0d99180b5ff6de92c76e42fe8624c2469b73ada3 2 parents a854e82 + da03387
@defnull defnull authored
Showing with 11 additions and 8 deletions.
  1. +10 −7 memcache/bottle_memcache.py
  2. +1 −1  memcache/setup.py
View
17 memcache/bottle_memcache.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
+# -*- mode:python; sh-basic-offset:4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim:set tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8:
#
@@ -12,7 +12,8 @@ class MemcachePlugin(object):
name = 'memcache'
- def __init__(self, servers=['localhost:11211', ], keyword='mc', server_max_value_length=memcache.SERVER_MAX_VALUE_LENGTH):
+ def __init__(self, servers=['localhost:11211', ], keyword='mc',
+ server_max_value_length=memcache.SERVER_MAX_VALUE_LENGTH):
self.servers = servers
self.keyword = keyword
@@ -20,7 +21,8 @@ def __init__(self, servers=['localhost:11211', ], keyword='mc', server_max_value
def setup(self, app):
for other in app.plugins:
- if not isinstance(other, MemcachePlugin): continue
+ if not isinstance(other, MemcachePlugin):
+ continue
if other.keyword == self.keyword:
raise PluginError("Found another memcache plugin with "\
"conflicting settings (non-unique keyword).")
@@ -29,18 +31,19 @@ def apply(self, callback, context):
conf = context['config'].get('memcache') or {}
servers = conf.get('servers', self.servers)
keyword = conf.get('keyword', self.keyword)
- server_max_value_length = conf.get('server_max_value_length', self.server_max_value_length)
+ server_max_value_length = conf.get('server_max_value_length',
+ self.server_max_value_length)
args = inspect.getargspec(context['callback'])[0]
if keyword not in args:
return callback
- def wrapper(*args,**kwargs):
- mc = memcache.Client(servers=self.servers, server_max_value_length=self.server_max_value_length, debug=0)
+ def wrapper(*args, **kwargs):
+ mc = memcache.Client(servers=self.servers,
+ server_max_value_length=self.server_max_value_length, debug=0)
kwargs[self.keyword] = mc
rv = callback(*args, **kwargs)
return rv
return wrapper
Plugin = MemcachePlugin
-
View
2  memcache/setup.py
@@ -24,7 +24,7 @@
setup(
name = 'bottle-memcache',
- version = '0.1',
+ version = '0.2',
url = 'http://github.com/bottlepy/bottle-extras/',
description = 'Memcache integration for Bottle.',
author = 'Jorge Gallegos',
Please sign in to comment.
Something went wrong with that request. Please try again.