I was away for two weeks and finally caught up with the git updates and the 
mailing list; what a pleasant surprise!

The before/after infrastructure is a joy. It is simple and elegant, much 
faster and more effective than the monkeypatching I submitted, AND with 
auditing implemented on top of it. Thank you very much Massimo, this is 
great!

You asked in the ticket -- yes, this is a great, efficient implementation 
of auditing.

A question I keep bugging (and submitting patches about) is the 
implementation of subsecond precision in the database. With the new code, I 
believe it is as simple as doing:

def change_datetime_and_time_to_string(fields):
  for k, v in fields.items():
    if isinstance(v, (datetime.datetime, datetime.time)): fields[k] = 
v.isoformat().replace('T', ' ')

_before_insert.append(change_datetime_and_time_to_string)

Is there a reason not to do that?

If not, would it be possible to make the DAL constructor append such a 
before_insert filter to any table? (As it is implemented, I would have to 
add it myself to tables that I want to apply it to).
A filter such as the above could be useful if it comes by default (but not 
inserted to the _before_insert list). Another useful filter would warn or 
raise an error if the time or datetime has a nonzero microsecond field -- 
useful for oracle or db2 which do not have that option.

Massimo, thanks again for the wonderful work - you are doing amazing work!

BTW: for datetime, it is possible to use x.isoformat(' ') instead of 
x.isoformat().replace('T', ' '); but for time, isoformat() takes no 
arguments.

Reply via email to