• R/O
  • SSH
  • HTTPS

shibuya-trac: Commit


Commit MetaInfo

Revision848 (tree)
Zeit2014-08-30 19:38:57
Autorjun66j5

Log Message

GanttCalendarPlugin: use iso8601 format for holiday.date column

Ändern Zusammenfassung

Diff

--- plugins/ganttcalendarplugin/trunk/ganttcalendar/admin.py (revision 847)
+++ plugins/ganttcalendarplugin/trunk/ganttcalendar/admin.py (revision 848)
@@ -5,6 +5,16 @@
55 from trac.admin import IAdminPanelProvider
66 from trac.core import Component, implements, TracError
77 from trac.env import IEnvironmentSetupParticipant
8+from trac.util.datefmt import format_date, parse_date
9+try:
10+ from trac.util.datefmt import user_time
11+except ImportError:
12+ def user_time(req, func, *args, **kwargs):
13+ if 'tzinfo' not in kwargs:
14+ kwargs['tzinfo'] = getattr(req, 'tz', None)
15+ if 'locale' not in kwargs:
16+ kwargs['locale'] = getattr(req, 'locale', None)
17+ return func(*args, **kwargs)
818
919 from ganttcalendar.translation import _, add_domain
1020
@@ -45,7 +55,10 @@
4555
4656 if req.method == 'POST':
4757 if req.args.get('add'):
48- keydate = req.args.get('date')
58+ keydate = req.args.getfirst('date')
59+ keydate = user_time(req, parse_date, keydate)
60+ keydate = user_time(req, format_date, keydate,
61+ format='iso8601')
4962 cursor.execute("SELECT COUNT(*) FROM holiday WHERE date=%s",
5063 (keydate,))
5164 for cnt, in cursor:
Show on old repository browser