stefanofontanelli/ColanderAlchemy

Feature inclusion: 'undictify' function

davidjb opened this issue · 8 comments

I've written most of an 'undictify' (world's worst name) function that given an appstruct (eg from Deform) and a ColanderAlchemy-mapped schema, returns a fully-formed SQLAlchemy model, deserialisng the appstruct and restoring it into the relevant mapped SQLAlchemy models (for new objects) and/or setting a given object's attributes accordingly (for updating existing objects in a database).

Sound like a good feature for inclusion as a function on the mapped CA schema? If so, I'll make a pull request once I'm finished.

I am flying to San Francisco. I will replay as soon as possible :)

Thank you for the effort :)

2013/3/16 David Beitey notifications@github.com

I've written most of an 'undictify' (world's worst name) function that
given an appstruct (eg from Deform) and a ColanderAlchemy-mapped schema,
returns a fully-formed SQLAlchemy model, deserialisng the appstruct and
restoring it into the relevant mapped SQLAlchemy models (for new objects)
and/or setting a given object's attributes accordingly (for updating
existing objects in a database).

Sound like a good feature for inclusion as a function on the mapped CA
schema? If so, I'll make a pull request once I'm finished.


Reply to this email directly or view it on GitHubhttps://github.com//issues/20
.

I think it is a great feature. I did a similar method in a job for one of my customers. Unfortunately I didn't include it in the master branch.
Please, send the PR to show me the code and discuss it :)

Any update?

+1 for this feature. It's far more robust than having to do

appstruct = myform.validate(controls)
DBSession.add(Clinician(**appstruct))

+1 from me too! Has there been any progress?

I've got some code, but it still needs a bit of adjustment (and tests written). I'll see what I can put together early next week when I'm back at my desk.

Great! I will add in next release.

Closing this issue as a pull request in #26 is now open.