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 #1352 (closed enhancement: fixed)

Opened 12 years ago

Last modified 12 years ago

[PATCH] Update FastData to work with TG 1.0.x

Reported by: Chris Arndt Owned by: Chris Arndt
Priority: normal Milestone: 1.0.4
Component: FastData Version: trunk
Severity: normal Keywords: fastdata, sqlobject


I have created a patch to make FastData? work with TurboGears 1.0.x and fix some bugs. Unfortunately the patch is rather big, since it is some time, since I created it, and I didn't take care t make the changes separately.

The patch partly overlaps with #1208 and a has fix for #1294.

Here's a summary of the changes:

M      tgfastdata/datacontroller.py
M      tgfastdata/datawidgets.py
M      tgfastdata/formmaker.py
A      tgfastdata/templates/editform.kid
  • Make a custom widget for the edit form with it's own template file (datacontroller.py / datawidgets.py / editform.kid)
  • 'list_filter' option to (Base)DataController, which should be either a) a SelectResult b) a SQLExpression c) a callable that returns a) or b) (datacontroller.py)
  • BaseDataController._get_instances() method that makes use of 'list_filer', if it is not None (datacontroller.py)
  • Handle joins when up filling the edit form and handle related joins when handling form submission to udate object (datacontroller.py)
  • Workaround for SQLObject quirk (bug?) in EmptyStringConverter: When setting an integer ForeignKey column, SO will accept a numerical string but not unicode, so we try to convert to string. (datawidgets.py)
  • New validator 'SaneDateConverter' to handle submission from CalendarDatePicker, which is broken in current TG, because DateConverter validator in FormEncode is brain dead. Probably we should really implement a proper DateConverter validator and submit it to FormEncode. (datawidgets.py)
  • Matching 'SaneCalendarDatePicker' widget. Subclass of widgets.CalendarDatePicker (datawidgets.py)
  • 'JoinSelect' widget, subclass of widgets.MultipleSelectField, to handle RelatedJoin fields (datawidgets.py)
  • Fix (outdated?) 'selected' method of 'DataSelectField' widget, that handles ForeignKey fields (datawidgets.py)
  • cleaned up and refactored 'column_widget_XXX' functions. Sorry, can't remember what all the changes where for, but I rember fixing some things that really didn't work and adding support for 'length' restrictions and multiple/related joins. (formmaker.py)
  • Inserted a few logging statements and a 'LoggingValidator' to make testing easier. Commented out for now. (datacontroller.py / datawidgets.py)

The patch is against trunk r2861.

If these changes should go in, I can make the effort to create seperate patches.


TGFastData-TG-1.x.patch Download (18.9 KB) - added by Chris Arndt 12 years ago.
tgfastdata-editform.patch Download (2.3 KB) - added by Chris Arndt 12 years ago.

Change History

Changed 12 years ago by Chris Arndt

comment:1 Changed 12 years ago by faide

  • Owner changed from anonymous to faide
  • Status changed from new to assigned

comment:2 Changed 12 years ago by faide

2 tests were failing before, and 2 tests are failing after the patch.

Applied. Thanks Chris!

comment:3 Changed 12 years ago by faide

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:4 Changed 12 years ago by yvesjmt

  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Type changed from enhancement to defect

(I'm reopening this ticket, I'm sorry if I should have opened a new one instead. )

Turns out the patch from Chris Arndt was applied but somehow the projects/tgfastdata/templates/editform.kid file was not included. So at least as of r3386, if you try to use the DataController to update an entry, it shows a 500 error saying editform.kid was not found.

I took the patch above and created editform.kid locally and it works for me.

comment:5 Changed 12 years ago by yvesjmt

  • Type changed from defect to enhancement

comment:6 Changed 12 years ago by Chris Arndt

  • Status changed from reopened to new
  • Owner changed from faide to Chris Arndt
  • Milestone changed from 1.0.2 to 1.0.4

Here's a patch that adds the missing editform.kid file, sets a validator for the JoinSelect widget and bumps up the version number to 0.9.a7.

Changed 12 years ago by Chris Arndt

comment:7 Changed 12 years ago by Chris Arndt

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

Fixed in r3387.

Note: See TracTickets for help on using tickets.