Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1057 (closed enhancement: wontfix)

Opened 13 years ago

Last modified 12 years ago

CalendarDatePicker should support setting the default date

Reported by: bjourne Owned by: anonymous
Priority: normal Milestone: 1.0b1
Component: TG Widgets Version: 0.9a6
Severity: normal Keywords:
Cc:

Description

from datetime import date
from turbogears.widgets import CalendarDatePicker
p = CalendarDatePicker()
p.default = date.today()

This doesn't work because the default property doesn't have a setter. But AFAICT, there is no reason why it shouldn't have one.

Attachments

default.patch Download (962 bytes) - added by alberto 13 years ago.

Change History

comment:1 Changed 13 years ago by jorge.vargas

  • Type changed from defect to enhancement
  • Milestone set to 1.0b1

please provide a patch and it will get into the next beta release :)

Changed 13 years ago by alberto

comment:2 Changed 13 years ago by alberto

That patch fixes it. However, I'm not sure I should commit it because widgets' attributes shouldn't be mutated once the widget is initialized. Well, actually it's once the widget is first displayed, but playing it safe and retracting the border to "once it's initialized" is easier to understand and get right IMO.

Your code can be rewritten as:

from datetime import date
from turbogears.widgets import CalendarDatePicker
p = CalendarDatePicker(default=date.today())

To sum up. I'd rather close this as wontfix.

comment:3 Changed 13 years ago by elvelind

  • Status changed from new to closed
  • Resolution set to wontfix

Unless there is a big reason for having it as an setter I will close this ticket.

comment:4 Changed 13 years ago by godoy

I vote for safety: wontfix.

Your solution on the controller works.

Note: See TracTickets for help on using tickets.