Here's what I'm trying to do: one of my model classes has 'date created' and 'date updated' DateTimeCol fields. Using a DataController, when I create a new entry, I want those two fields to be set the same. When I update an entry, I want the 'date updated' field set to now().
My first naive attempt was to do this in the model itself. I gave the class a __setattr__ method which sets 'date updated' to now() whenever any field in the class is set. This did not work out very well. When I bring up the DataControllers 'add' form, enter the data, and submit, the time it took to enter the data is now reflected in the 'date updated' field, so 'date created' and 'date updated' are different. Not good. My next thought was to do this in the controller. However, DataController is pretty opaque. I have no 'hooks' for doing this. What I would need is for DataController to provide me with the ability to set a python callback to a function that would be executed between the point where the form was submitted, and the point where the data is actually written to the database. It seems a shame that in order to do what I want, I would have to basically replicate all the code from DataController just to provide my own version that gave me the callbacks I needed. So, should DataController provide those callbacks? Or (more probably :) ), am I going about this the wrong way? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk -~----------~----~----~----~------~----~------~--~---
