Mercurial > p > roundup > code
comparison doc/customizing.txt @ 3717:5770f1802cd0
better conflict retry in postgresql backend [SF#1552809]
fix time log example [SF#1554630]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 03 Oct 2006 23:28:51 +0000 |
| parents | af6eeba3a3f3 |
| children | 0d561b24ceff |
comparison
equal
deleted
inserted
replaced
| 3716:4cbbf9210edd | 3717:5770f1802cd0 |
|---|---|
| 1 =================== | 1 =================== |
| 2 Customising Roundup | 2 Customising Roundup |
| 3 =================== | 3 =================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.207 $ | 5 :Version: $Revision: 1.208 $ |
| 6 | 6 |
| 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: | 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: |
| 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx | 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx |
| 9 | 9 |
| 10 .. contents:: | 10 .. contents:: |
| 3371 some Python code, since it's beyond the scope of PageTemplates to | 3371 some Python code, since it's beyond the scope of PageTemplates to |
| 3372 perform such calculations. We do this by adding a module ``timespent.py`` | 3372 perform such calculations. We do this by adding a module ``timespent.py`` |
| 3373 to the ``extensions`` directory in our tracker. The contents of this | 3373 to the ``extensions`` directory in our tracker. The contents of this |
| 3374 file is as follows:: | 3374 file is as follows:: |
| 3375 | 3375 |
| 3376 from roundup import date | |
| 3377 | |
| 3376 def totalTimeSpent(times): | 3378 def totalTimeSpent(times): |
| 3377 ''' Call me with a list of timelog items (which have an | 3379 ''' Call me with a list of timelog items (which have an |
| 3378 Interval "period" property) | 3380 Interval "period" property) |
| 3379 ''' | 3381 ''' |
| 3380 total = Interval('0d') | 3382 total = date.Interval('0d') |
| 3381 for time in times: | 3383 for time in times: |
| 3382 total += time.period._value | 3384 total += time.period._value |
| 3383 return total | 3385 return total |
| 3384 | 3386 |
| 3385 def init(instance): | 3387 def init(instance): |
