beaker example not working; convert to dogpile

Issue #2589 resolved
Mike Bayer repo owner created an issue

No description provided.

Comments (4)

  1. Mike Bayer reporter

    add test coverage for this to orm/util.py, so that existing beaker cache installations keep working:

    diff -r 06af57b05f9a0aebfcdd86e9def41a6c82513429 lib/sqlalchemy/orm/util.py
    --- a/lib/sqlalchemy/orm/util.py    Thu Oct 11 11:15:29 2012 -0400
    +++ b/lib/sqlalchemy/orm/util.py    Thu Oct 11 11:36:50 2012 -0400
    @@ -352,9 +352,12 @@
             self.reduced_path = parent.reduced_path + (key,)
    
         def __getitem__(self, entity):
    -        return EntityRegistry(
    -            self, entity
    -        )
    +        if isinstance(entity, (int, slice)):
    +            return self.path[entity](entity)
    +        else:
    +            return EntityRegistry(
    +                self, entity
    +            )
    
     class EntityRegistry(PathRegistry, dict):
         is_aliased_class = False
    
  2. Log in to comment