ec8602f95ff5916925c54a9adfc867112b2d5b70,poseidon/poseidonStorage/poseidonStorage.py,db_add_one_doc,on_get,#db_add_one_doc#Any#Any#Any#Any#Any#,191

Before Change



    def on_get(self, req, resp, database, collection, doc_str):
        try:
            doc = urllib.unquote(doc).decode("utf8")
            doc = ast.literal_eval(doc)
            ret = self.client[database][collection].insert_one(doc)
            ret = str(ret.inserted_id)
        except:
            ret = "Error inserting document into database."

After Change


    def on_get(self, req, resp, database, collection, doc_str):
        try:
            if not bson.is_valid(doc_str):
                doc_str = bson.BSON.encode(doc_str)
            ret = self.client[database][collection].insert_one(doc_str)
            ret = str(ret.inserted_id)
        except:
            ret = "Error inserting document into database."
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: CyberReboot/poseidon
Commit Name: ec8602f95ff5916925c54a9adfc867112b2d5b70
Time: 2016-08-09
Author: tlanham@cs.stanford.edu
File Name: poseidon/poseidonStorage/poseidonStorage.py
Class Name: db_add_one_doc
Method Name: on_get


Project Name: CyberReboot/poseidon
Commit Name: ec8602f95ff5916925c54a9adfc867112b2d5b70
Time: 2016-08-09
Author: tlanham@cs.stanford.edu
File Name: poseidon/poseidonStorage/test_poseidonStorage.py
Class Name:
Method Name: test_db_add_many_docs


Project Name: CyberReboot/poseidon
Commit Name: 262f2dd76cd516d0be4a73e87e72a39938a18795
Time: 2016-08-10
Author: tlanham@cs.stanford.edu
File Name: poseidon/poseidonStorage/test_poseidonStorage.py
Class Name:
Method Name: test_db_add_many_docs


Project Name: CyberReboot/poseidon
Commit Name: 262f2dd76cd516d0be4a73e87e72a39938a18795
Time: 2016-08-10
Author: tlanham@cs.stanford.edu
File Name: poseidon/poseidonStorage/poseidonStorage.py
Class Name: db_add_one_doc
Method Name: on_get