More verbose undo/transaction desciptions
Is it possible to make the Undo tab's list of transactions more verbose? Say that I change the value of one property of an object, and then at a later time change another property of the same object. In the object's Undo tab, there's only displayed, that I called the "editTheObject-something" method twice, not which properties that were changed. Is it something that I tweak in my product's code? - Carsten
If this is for your own python filesystem product you could make a call in the filesystem python code like... get_transaction().note('I just foobared my widget') ...and then that's what shows up for it on the undo list. jens On Wednesday, Jul 30, 2003, at 17:26 US/Eastern, Carsten Gehling wrote:
Is it possible to make the Undo tab's list of transactions more verbose?
Say that I change the value of one property of an object, and then at a later time change another property of the same object. In the object's Undo tab, there's only displayed, that I called the "editTheObject-something" method twice, not which properties that were changed.
Is it something that I tweak in my product's code?
- Carsten
Yes that did the trick, and that - of course - gave birth to a few more questions: 1) Can i do any linebreaks in this note() function? It's to make it look nicer on the Undo list. I've tried with \n and <br> but neither gives the expected result (<br> is converted to <br> and \n is of course just ignored by the browser). 2) As said before, I want to use this to let the manager know which attributes in the object, that has been altered. Currently I do it like this: -------------------------------------------------- class TVTeknik(SimpleItem): "Et TVTeknik objekt" meta_type = "TV Teknik" def __init__(self, id, serienummer = ""): self.id = id self.editTVTeknik(serienummer) def editTVTeknik(self, serienummer = "", model = "", fabrikat = "", REQUEST = None): "Metode til at opdatere data" l = [] try: if self.serienummer != serienummer: l.append("serienummer: '%s' => '%s'" % (self.serienummer, serienummer)) self.serienummer = serienummer except: self.serienummer = serienummer try: if self.model != model: l.append("model: '%s' => '%s'" % (self.model, model)) self.model = model except: self.model = model try: if self.fabrikat != fabrikat: l.append("fabrikat: '%s' => '%s'" % (self.fabrikat, fabrikat)) self.fabrikat = fabrikat except: self.fabrikat = fabrikat if len(l) > 0: s = " | Opdaterede felter: %s" % string.join(l, ", ") get_transaction().note(s) self.__changed__(1) -------------------------------------------------- BUT add only a few more attributes, and the code gets unnessarily long. Maybe it's because I haven't got enough Python experience. Isn't there a way of looping through the function arguments so all this could be made as a loop? Something like (mind you, this is NOT intended to be valid Python code - just a sort of pseudo): def editTVTeknik(self, serienummer = "", model = "", fabrikat = "", REQUEST = None): "Metode til at opdatere data" l = [] for a in function_arguments: try: if eval('self.' + a.name) != a.value: l.append("%s: '%s' => '%s'" % (a.name, eval('self.'+a.name, a.value))) eval('self.' + a.name) = a.value except: eval('self.' + a.name) = a.value if len(l) > 0: s = " | Opdaterede felter: %s" % string.join(l, ", ") get_transaction().note(s) self.__changed__(1) - Carsten
-----Oprindelig meddelelse----- Fra: zope-admin@zope.org [mailto:zope-admin@zope.org]Pa vegne af Jens Vagelpohl Sendt: 30. juli 2003 23:46 Til: Carsten Gehling Cc: Zope@Zope.Org Emne: Re: [Zope] More verbose undo/transaction desciptions
If this is for your own python filesystem product you could make a call in the filesystem python code like...
get_transaction().note('I just foobared my widget')
...and then that's what shows up for it on the undo list.
jens
On Wednesday, Jul 30, 2003, at 17:26 US/Eastern, Carsten Gehling wrote:
Is it possible to make the Undo tab's list of transactions more verbose?
Say that I change the value of one property of an object, and then at a later time change another property of the same object. In the object's Undo tab, there's only displayed, that I called the "editTheObject-something" method twice, not which properties that were changed.
Is it something that I tweak in my product's code?
- Carsten
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
1) Can i do any linebreaks in this note() function? It's to make it look nicer on the Undo list. I've tried with \n and <br> but neither gives the expected result (<br> is converted to <br> and \n is of course just ignored by the browser).
No idea. Never tried it and never had the need for it. The Undo screen is not really targetted to non-technical people who need everything explained 8-) jens
On Thursday 31 July 2003 10:24, Carsten Gehling wrote:
Yes that did the trick, and that - of course - gave birth to a few more questions:
1) Can i do any linebreaks in this note() function? It's to make it look nicer on the Undo list. I've tried with \n and <br> but neither gives the expected result (<br> is converted to <br> and \n is of course just ignored by the browser).
2) As said before, I want to use this to let the manager know which attributes in the object, that has been altered. Currently I do it like this:
I have a patch to do exactly what you want, in the Zope Collector. http://collector.zope.org/Zope/807 It may need some handwork to apply to 2.7.... Please let me know what you think. -- Toby Dickenson - http://www.geminidataloggers.com/people/tdickenson Want a job like mine? http://www.geminidataloggers.com/jobs for Software Engineering jobs at Gemini Data Loggers in Chichester, West Sussex, England
How do apply the patch on the Windows platform? - Carsten
-----Oprindelig meddelelse----- Fra: zope-admin@zope.org [mailto:zope-admin@zope.org]På vegne af Toby Dickenson Sendt: 31. juli 2003 15:10 Til: Carsten Gehling; Jens Vagelpohl Cc: Zope@Zope.Org Emne: Re: SV: [Zope] More verbose undo/transaction desciptions
On Thursday 31 July 2003 10:24, Carsten Gehling wrote:
Yes that did the trick, and that - of course - gave birth to a few more questions:
1) Can i do any linebreaks in this note() function? It's to make it look nicer on the Undo list. I've tried with \n and <br> but neither gives the expected result (<br> is converted to <br> and \n is of course just ignored by the browser).
2) As said before, I want to use this to let the manager know which attributes in the object, that has been altered. Currently I do it like this:
I have a patch to do exactly what you want, in the Zope Collector.
http://collector.zope.org/Zope/807
It may need some handwork to apply to 2.7.... Please let me know what you think.
-- Toby Dickenson - http://www.geminidataloggers.com/people/tdickenson
Want a job like mine? http://www.geminidataloggers.com/jobs for Software Engineering jobs at Gemini Data Loggers in Chichester, West Sussex, England
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Carsten Gehling -
Carsten Gehling -
Jens Vagelpohl -
Toby Dickenson