diff options
author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2019-05-14 14:56:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-14 14:56:31 +0200 |
commit | e766d3c44269a3564e740ac2b840c1b8108ee810 (patch) | |
tree | 5d41e0d33d95ddb7a8de40c07ddb5e646f98d861 | |
parent | 4e660fe05bb97093a6304dd2e44340a397d75a94 (diff) | |
parent | 107fad11d9eee0f4d6cd8977d0ca6be8225ee857 (diff) | |
download | pysaml2-e766d3c44269a3564e740ac2b840c1b8108ee810.tar.gz |
Merge pull request #617 from SUNET/eduid-mongodb_timestamps
Add timestamps for ident mongodb documents
-rw-r--r-- | src/saml2/mongo_store.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/saml2/mongo_store.py b/src/saml2/mongo_store.py index 4120e9e0..903dd481 100644 --- a/src/saml2/mongo_store.py +++ b/src/saml2/mongo_store.py @@ -1,3 +1,4 @@ +import datetime from hashlib import sha1 import logging @@ -211,6 +212,9 @@ class MDB(object): else: doc = {} doc.update(kwargs) + # Add timestamp to all documents to allow external garbage collecting + if "created_at" not in doc: + doc["created_at"] = datetime.datetime.utcnow() _ = self.db.insert(doc) def get(self, value=None, **kwargs): |