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

MongoNamespaceManager using forward slash in namespace for windows environment #178

Open
ricksore opened this issue Aug 22, 2019 · 1 comment

Comments

@ricksore
Copy link

I'm currently using a pyramid + mongodb + beaker stack in a project.
Tried using cache_region and region_invalidate but the namespace being supplied to the MongoDB write is written in forward slash (native windows directory listing).
My hack was to replace the forward slashes in the namespace to backward slashes.

    def _clear_expired(self):
        now = time.time()
        self.namespace = self.namespace.replace('\\', '/')
        self.db.backer_cache.delete_many({'_id': {'$regex': '^%s' % self.namespace},
                                          'expiration': {'$ne': None, '$lte': now}})
@amol-
Copy link
Collaborator

amol- commented Aug 22, 2019

Not sure I got why this should only happen in _clear_expired.
I get that cache_region is going to generate a namespace based on the file names on disk, which is something you might not want, but the namespace is persisted in the decorated function as _arg_namespace so it should be consistent between cache_region and region_invalidate and always have the same kind of slashes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants