How to turn the validator to logger

29 views
Skip to first unread message

mohammed alserr

unread,
Oct 20, 2014, 9:16:29 AM10/20/14
to mong...@googlegroups.com
Hello people , 

I really likes the mongokit and how flexible it is to work with dictionaries . but I'm trying to cease my own RootDocument that writes to a file when a new document is saved in mongo no matters what the type of document . 

so it will look like this :- 

def log_changes_to_log_file():
    if all_good:
        return True
        print "All good. save changes to file "
    else:
        print "some thing went wrong"


class RootDocument(Document):
    validators = {"all" : log_changes_to_log_file()}

Kindly regards, 
Mo

Nicolas Clairon

unread,
Oct 20, 2014, 9:21:55 AM10/20/14
to mong...@googlegroups.com
Why don't you overload the "save" method instead ?
--

---
You received this message because you are subscribed to the Google Groups "MongoKit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongokit+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages