Beispiel #1
0
def delete_mclogs(model_name, model_key, modifier_id):
    query = MCLog.all()
    query.filter("model_name =", model_name)
    query.filter("model_key =", str(model_key))
    mclogs = query.fetch()
    for mclog in mclogs:
        query2 = MCLogDetail.all()
        query2.filter("changelog_id =", mclog.key())
        query2.delete()
        mclog.delete()
Beispiel #2
0
def fetch_mclogs(model_name, model_key, **kwds):
    query = MCLog.all()
    query.filter("model_name =", model_name)
    query.filter("model_key =", str(model_key))
    mclogs = query.fetch()
    for mclog in mclogs:
        query = MCLogDetail.all()
        query.filter("changelog_id =", mclog.key())
        mclog.logDetails = query.fetch()
        for logdetail in mclog.logDetails:
            if kwds.has_key(logdetail.field_name):
                fvalue_last = None if logdetail.fvalue_last == 'None' else logdetail.fvalue_last
                fvalue_present = None if logdetail.fvalue_present == 'None' else logdetail.fvalue_present
                logdetail.fvalue_last = kwds[logdetail.field_name](fvalue_last)
                logdetail.fvalue_present = kwds[logdetail.field_name](fvalue_present)
        mclog.userDisplayName = user.get_user_display_name(mclog.user_id)
    return mclogs
Beispiel #3
0
 def testAddMCLog(self):
     tmodel = self.TModel()
     tmodel.f_str = "abcd"
     tmodel.f_int = 100
     tmodel.f_float = 1000.0
     tmodel.f_bool = False
     tmodel.f_float_logged = 1.0
     tmodel.f_str_logged = "1234"
     tmodel.create(2)
     tmodel.f_str = 'abcd1'
     tmodel.f_float = 1001.0
     tmodel.f_float_logged = 2.0
     tmodel.f_str_logged = "123456"
     tmodel.put(2)
     query = MCLog.all()
     self.assertEqual(query.count(), 1)
     query = MCLogDetail.all()
     self.assertEqual(query.count(), 2)