Ticket #961 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

[super] Refactoring of forms, validation and model synchronization

Reported by: rgrp Owned by: kindly
Priority: blocker Milestone: ckan-v1.5
Component: ckan Keywords:
Cc: Repository: ckan
Theme: none

Description (last modified by rgrp) (diff)

This is a meta-ticket to hold all of the work on refactoring forms, validation and model-synchronization in CKAN.

ckan-dev thread: http://lists.okfn.org/pipermail/ckan-dev/2011-January/000180.html

The Issue

From #926:

The current formalchemy setup conflates view, controller and model code in a way that makes it hard to debug and customise.

From http://lists.okfn.org/pipermail/ckan-dev/2011-January/000181.html:

... FormAlchemy, in retrospect, was probably a mistake as it merges too much model/validation/form generation into one thing.

At least 3 functions involved [in this area]:

  1. Generating (or just filling) a form template with 'form data' (and errors)
  2. Converting model data to form data (also happens for APIs in fact) -- let's call this 'dict-ization'
  3. Converting form data to model data (and validating) (inverse of previous step)

Related Tickets

  • #926 - Pick a simpler form framework
  • #1046 'dictization' and the logic layer - serialization / deserialization of package (and other domain objects) to standard intermediate format such as json-convertable python dict
    • #1079 Refactor API to use new logic layer and dictization
    • #1078 Refactor WUI controllers and forms to use logic layer
    • cf existing dumper and importer code
    • This will fix #662
  • [not ticketed yet] - validation layer (should work on serialized objects?)
  • #662 - Can't put entity that is returned by posting to package register (Defect)
  • #972 - Merge 'extras' into main package dict rather than having separate key
  • #1035 - Form impressions are given IDs
  • #810 - Move "add packages" field up in group form (easier to do this once forms are done)

Change History

comment:1 Changed 3 years ago by dread

So you also need:

  1. Converting form data to dict
  2. Converting dict to model

i.e. the dict is not the same as the serialized form data or model data.

comment:2 Changed 3 years ago by rgrp

  • Description modified (diff)

comment:3 Changed 3 years ago by sebbacon

  • Milestone changed from ckan-v1.4-sprint-1 to ckan-v1.4-sprint-3

comment:4 Changed 3 years ago by dread

  • Description modified (diff)

comment:5 Changed 3 years ago by rgrp

  • Description modified (diff)

comment:6 Changed 3 years ago by rgrp

  • Repository set to ckan
  • Theme set to none
  • Description modified (diff)

comment:7 Changed 3 years ago by rgrp

  • Owner changed from sebbacon to kindly
  • Summary changed from Refactoring of forms, validation and model synchronization to [super] Refactoring of forms, validation and model synchronization
  • Milestone changed from ckan-v1.4-sprint-3 to ckan-v1.4

comment:8 Changed 3 years ago by rgrp

  • Description modified (diff)

comment:9 Changed 3 years ago by rgrp

  • Description modified (diff)

comment:10 Changed 3 years ago by rgrp

@kindly: can we close this ticket now. All the meat is done and the remaining related tickets are either low priority or possibly wontfix.

comment:11 Changed 3 years ago by shevski

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

The main parts of this ticket are now done. The remaining parts can be dealt with separately as their own tickets.

Note: See TracTickets for help on using tickets.