Fix all_pks to work if decode_responses=False
This commit is contained in:
		
							parent
							
								
									c7c6dffe7a
								
							
						
					
					
						commit
						6c8cf0b01d
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
[tool.poetry]
 | 
					[tool.poetry]
 | 
				
			||||||
name = "redis-om"
 | 
					name = "redis-om"
 | 
				
			||||||
version = "0.0.9"
 | 
					version = "0.0.11"
 | 
				
			||||||
description = "A high-level library containing useful Redis abstractions and tools, like an ORM and leaderboard."
 | 
					description = "A high-level library containing useful Redis abstractions and tools, like an ORM and leaderboard."
 | 
				
			||||||
authors = ["Andrew Brookins <andrew.brookins@redis.com>"]
 | 
					authors = ["Andrew Brookins <andrew.brookins@redis.com>"]
 | 
				
			||||||
maintainers = ["Andrew Brookins <andrew.brookins@redis.com>"]
 | 
					maintainers = ["Andrew Brookins <andrew.brookins@redis.com>"]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1210,8 +1210,11 @@ class HashModel(RedisModel, abc.ABC):
 | 
				
			||||||
        # TODO: We assume the key ends with the default separator, ":" -- when
 | 
					        # TODO: We assume the key ends with the default separator, ":" -- when
 | 
				
			||||||
        #  we make the separator configurable, we need to update this as well.
 | 
					        #  we make the separator configurable, we need to update this as well.
 | 
				
			||||||
        #  ... And probably lots of other places ...
 | 
					        #  ... And probably lots of other places ...
 | 
				
			||||||
 | 
					        #
 | 
				
			||||||
 | 
					        # TODO: Also, we need to decide how we want to handle the lack of
 | 
				
			||||||
 | 
					        #  decode_responses=True...
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
            key.split(":")[-1]
 | 
					            key.split(":")[-1] if isinstance(key, str) else key.decode(cls.Meta.encoding).split(":")[-1]
 | 
				
			||||||
            for key in cls.db().scan_iter(f"{key_prefix}*", _type="HASH")
 | 
					            for key in cls.db().scan_iter(f"{key_prefix}*", _type="HASH")
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue