Hello community, here is the log from the commit of package python-redis for openSUSE:Factory checked in at 2012-06-05 15:34:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-redis (Old) and /work/SRC/openSUSE:Factory/.python-redis.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-redis", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-redis/python-redis.changes 2012-02-14 11:26:40.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-redis.new/python-redis.changes 2012-06-05 15:35:03.000000000 +0200 @@ -1,0 +2,9 @@ +Sat Jun 2 22:35:06 UTC 2012 - [email protected] + +- Update to 2.4.13: + * redis.from_url() can take an URL representing a Redis connection string + and return a client object. Thanks Kenneth Reitz for the patch. +- Changes in 2.4.12: + * ConnectionPool is now fork-safe. Thanks Josiah Carson for the patch. + +------------------------------------------------------------------- Old: ---- redis-2.4.11.tar.gz New: ---- redis-2.4.13.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-redis.spec ++++++ --- /var/tmp/diff_new_pack.aM8QS1/_old 2012-06-05 15:35:04.000000000 +0200 +++ /var/tmp/diff_new_pack.aM8QS1/_new 2012-06-05 15:35:04.000000000 +0200 @@ -16,7 +16,7 @@ # Name: python-redis -Version: 2.4.11 +Version: 2.4.13 Release: 0 Url: http://github.com/andymccurdy/redis-py Summary: Python client for Redis key-value store ++++++ redis-2.4.11.tar.gz -> redis-2.4.13.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/CHANGES new/redis-2.4.13/CHANGES --- old/redis-2.4.11/CHANGES 2012-01-13 22:47:27.000000000 +0100 +++ new/redis-2.4.13/CHANGES 2012-05-19 00:20:58.000000000 +0200 @@ -1,3 +1,8 @@ +* 2.4.13 + * redis.from_url() can take an URL representing a Redis connection string + and return a client object. Thanks Kenneth Reitz for the patch. +* 2.4.12 + * ConnectionPool is now fork-safe. Thanks Josiah Carson for the patch. * 2.4.11 * AuthenticationError will now be correctly raised if an invalid password is supplied. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/PKG-INFO new/redis-2.4.13/PKG-INFO --- old/redis-2.4.11/PKG-INFO 2012-01-13 22:48:58.000000000 +0100 +++ new/redis-2.4.13/PKG-INFO 2012-05-19 00:21:42.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.0 Name: redis -Version: 2.4.11 +Version: 2.4.13 Summary: Python client for Redis key-value store Home-page: http://github.com/andymccurdy/redis-py Author: Andy McCurdy Author-email: [email protected] License: MIT -Download-URL: http://cloud.github.com/downloads/andymccurdy/redis-py/redis-2.4.11.tar.gz +Download-URL: http://cloud.github.com/downloads/andymccurdy/redis-py/redis-2.4.13.tar.gz Description: # redis-py The Python interface to the Redis key-value store. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/redis/__init__.py new/redis-2.4.13/redis/__init__.py --- old/redis-2.4.11/redis/__init__.py 2012-01-13 22:48:06.000000000 +0100 +++ new/redis-2.4.13/redis/__init__.py 2012-05-19 00:20:48.000000000 +0200 @@ -4,6 +4,7 @@ Connection, UnixDomainSocketConnection ) +from redis.utils import from_url from redis.exceptions import ( AuthenticationError, ConnectionError, @@ -16,12 +17,12 @@ ) -__version__ = '2.4.11' +__version__ = '2.4.13' VERSION = tuple(map(int, __version__.split('.'))) __all__ = [ 'Redis', 'StrictRedis', 'ConnectionPool', 'Connection', 'UnixDomainSocketConnection', 'RedisError', 'ConnectionError', 'ResponseError', 'AuthenticationError', - 'InvalidResponse', 'DataError', 'PubSubError', 'WatchError', + 'InvalidResponse', 'DataError', 'PubSubError', 'WatchError', 'from_url', ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/redis/client.py new/redis-2.4.13/redis/client.py --- old/redis-2.4.11/redis/client.py 2012-01-13 22:45:24.000000000 +0100 +++ new/redis-2.4.13/redis/client.py 2012-04-28 00:37:07.000000000 +0200 @@ -15,7 +15,7 @@ def list_or_args(keys, args): # returns a single list combining keys and args try: - i = iter(keys) + iter(keys) # a string can be iterated, but indicates # keys wasn't passed as a list if isinstance(keys, basestring): @@ -240,7 +240,8 @@ with self.pipeline(True, shard_hint) as pipe: while 1: try: - pipe.watch(*watches) + if watches: + pipe.watch(*watches) func(pipe) return pipe.execute() except WatchError: @@ -457,8 +458,8 @@ """ Returns a list of values ordered identically to ``keys`` """ - keys = list_or_args(keys, args) - return self.execute_command('MGET', *keys) + args = list_or_args(keys, args) + return self.execute_command('MGET', *args) def mset(self, mapping): "Sets each key in the ``mapping`` dict to its corresponding value" @@ -777,29 +778,29 @@ def sdiff(self, keys, *args): "Return the difference of sets specified by ``keys``" - keys = list_or_args(keys, args) - return self.execute_command('SDIFF', *keys) + args = list_or_args(keys, args) + return self.execute_command('SDIFF', *args) def sdiffstore(self, dest, keys, *args): """ Store the difference of sets specified by ``keys`` into a new set named ``dest``. Returns the number of keys in the new set. """ - keys = list_or_args(keys, args) - return self.execute_command('SDIFFSTORE', dest, *keys) + args = list_or_args(keys, args) + return self.execute_command('SDIFFSTORE', dest, *args) def sinter(self, keys, *args): "Return the intersection of sets specified by ``keys``" - keys = list_or_args(keys, args) - return self.execute_command('SINTER', *keys) + args = list_or_args(keys, args) + return self.execute_command('SINTER', *args) def sinterstore(self, dest, keys, *args): """ Store the intersection of sets specified by ``keys`` into a new set named ``dest``. Returns the number of keys in the new set. """ - keys = list_or_args(keys, args) - return self.execute_command('SINTERSTORE', dest, *keys) + args = list_or_args(keys, args) + return self.execute_command('SINTERSTORE', dest, *args) def sismember(self, name, value): "Return a boolean indicating if ``value`` is a member of set ``name``" @@ -827,16 +828,16 @@ def sunion(self, keys, *args): "Return the union of sets specifiued by ``keys``" - keys = list_or_args(keys, args) - return self.execute_command('SUNION', *keys) + args = list_or_args(keys, args) + return self.execute_command('SUNION', *args) def sunionstore(self, dest, keys, *args): """ Store the union of sets specified by ``keys`` into a new set named ``dest``. Returns the number of keys in the new set. """ - keys = list_or_args(keys, args) - return self.execute_command('SUNIONSTORE', dest, *keys) + args = list_or_args(keys, args) + return self.execute_command('SUNIONSTORE', dest, *args) #### SORTED SET COMMANDS #### @@ -1089,9 +1090,10 @@ items.extend(pair) return self.execute_command('HMSET', name, *items) - def hmget(self, name, keys): + def hmget(self, name, keys, *args): "Returns a list of values ordered identically to ``keys``" - return self.execute_command('HMGET', name, *keys) + args = list_or_args(keys, args) + return self.execute_command('HMGET', name, *args) def hvals(self, name): "Return the list of values within hash ``name``" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/redis/connection.py new/redis-2.4.13/redis/connection.py --- old/redis-2.4.11/redis/connection.py 2011-11-08 01:57:26.000000000 +0100 +++ new/redis-2.4.13/redis/connection.py 2012-05-19 00:10:28.000000000 +0200 @@ -1,3 +1,4 @@ +import os import socket from itertools import chain, imap from redis.exceptions import ( @@ -34,7 +35,7 @@ def on_connect(self, connection): "Called when the socket connects" - self._fp = connection._sock.makefile('r') + self._fp = connection._sock.makefile('rb') def on_disconnect(self): "Called when the socket disconnects" @@ -163,6 +164,7 @@ def __init__(self, host='localhost', port=6379, db=0, password=None, socket_timeout=None, encoding='utf-8', encoding_errors='strict', parser_class=DefaultParser): + self.pid = os.getpid() self.host = host self.port = port self.db = db @@ -284,6 +286,7 @@ def __init__(self, path='', db=0, password=None, socket_timeout=None, encoding='utf-8', encoding_errors='strict', parser_class=DefaultParser): + self.pid = os.getpid() self.path = path self.db = db self.password = password @@ -316,6 +319,7 @@ "Generic connection pool" def __init__(self, connection_class=Connection, max_connections=None, **connection_kwargs): + self.pid = os.getpid() self.connection_class = connection_class self.connection_kwargs = connection_kwargs self.max_connections = max_connections or 2**31 @@ -323,8 +327,14 @@ self._available_connections = [] self._in_use_connections = set() + def _checkpid(self): + if self.pid != os.getpid(): + self.disconnect() + self.__init__(self.connection_class, self.max_connections, **self.connection_kwargs) + def get_connection(self, command_name, *keys, **options): "Get a connection from the pool" + self._checkpid() try: connection = self._available_connections.pop() except IndexError: @@ -341,8 +351,10 @@ def release(self, connection): "Releases the connection back to the pool" - self._in_use_connections.remove(connection) - self._available_connections.append(connection) + self._checkpid() + if connection.pid == self.pid: + self._in_use_connections.remove(connection) + self._available_connections.append(connection) def disconnect(self): "Disconnects all connections in the pool" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/redis/utils.py new/redis-2.4.13/redis/utils.py --- old/redis-2.4.11/redis/utils.py 1970-01-01 01:00:00.000000000 +0100 +++ new/redis-2.4.13/redis/utils.py 2012-05-19 00:18:21.000000000 +0200 @@ -0,0 +1,31 @@ +from urlparse import urlparse + +from .client import Redis + +DEFAULT_DATABASE_ID = 0 + +def from_url(url, db=None): + """Returns an active Redis client generated from the given database URL. + + Will attempt to extract the database id from the path url fragment, if + none is provided. + """ + + url = urlparse(url) + + # Make sure it's a redis database. + if url.scheme: + assert url.scheme == 'redis' + + # Attempt to resolve database id. + if db is None: + try: + db = int(url.path.replace('/', '')) + except (AttributeError, ValueError): + db = DEFAULT_DATABASE_ID + + return Redis( + host=url.hostname, + port=url.port, + db=db, + password=url.password) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/redis.egg-info/PKG-INFO new/redis-2.4.13/redis.egg-info/PKG-INFO --- old/redis-2.4.11/redis.egg-info/PKG-INFO 2012-01-13 22:48:58.000000000 +0100 +++ new/redis-2.4.13/redis.egg-info/PKG-INFO 2012-05-19 00:21:42.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 1.0 Name: redis -Version: 2.4.11 +Version: 2.4.13 Summary: Python client for Redis key-value store Home-page: http://github.com/andymccurdy/redis-py Author: Andy McCurdy Author-email: [email protected] License: MIT -Download-URL: http://cloud.github.com/downloads/andymccurdy/redis-py/redis-2.4.11.tar.gz +Download-URL: http://cloud.github.com/downloads/andymccurdy/redis-py/redis-2.4.13.tar.gz Description: # redis-py The Python interface to the Redis key-value store. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/redis-2.4.11/redis.egg-info/SOURCES.txt new/redis-2.4.13/redis.egg-info/SOURCES.txt --- old/redis-2.4.11/redis.egg-info/SOURCES.txt 2012-01-13 22:48:58.000000000 +0100 +++ new/redis-2.4.13/redis.egg-info/SOURCES.txt 2012-05-19 00:21:42.000000000 +0200 @@ -8,6 +8,7 @@ redis/client.py redis/connection.py redis/exceptions.py +redis/utils.py redis.egg-info/PKG-INFO redis.egg-info/SOURCES.txt redis.egg-info/dependency_links.txt -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
