Teach Fieldmapper (Perl) to record and expose field datatype

Bug #959594 reported by Mike Rylander
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Wishlist
Unassigned

Bug Description

From the commit on http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/miker/field_datatype_exposed

    We record most everything from the IDL, but until now we skipped datatype
    because it's generally not useful in perl. But, there might be uses. So
    now we record it, and expose it through the class and instance FieldDatatype
    method. Also added is a more general FieldInfo method, which returns a hash
    containing field attributes, including but not limited to:

     * virtual [1|0]
     * required [1|0]
     * position [array position for internal implementation]
     * datatype [bool|float|id|int|interval|link|money|number|org_unit|text|timestamp]
     * validate [regexp]

Tags: pullrequest
Changed in evergreen:
milestone: none → 2.2.0beta1
Revision history for this message
Dan Scott (denials) wrote :

Missed the cutoff for new features in 2.2.x, unfortunately, so I'm removing the milestone for now (as agreed in IRC with Mike).

Changed in evergreen:
milestone: 2.2.0beta1 → none
Changed in evergreen:
milestone: none → 2.3.0-beta1
Revision history for this message
Dan Scott (denials) wrote :

Mike - can you provide any concrete use cases for this functionality? Although applying the patch doesn't seem to introduce any errors, I'm reluctant to add what might end up being unused code to our code base.

To take a stab at a possible use case: given Template::Toolkit, I guess we could build some auto-display widgets for IDL objects that surface the appropriate form controls?

Changed in evergreen:
milestone: 2.3.0-beta1 → none
importance: Undecided → Wishlist
Revision history for this message
Mike Rylander (mrylander) wrote :

Dan, the auto-widgeting is one I had in mind. Another use case is to give perl methods the ability to validate and canonicalize object properties before attempting to save them. Yet another is the ability to provide reasonable application-side defaults to fields of new or dummy objects.

This code was offered an expansion of, and alternative OO-ish API to, a branch proposed (again, IIRC) by Jason Stephenson for use in SIP2. I believe that branch provided a O::U::Fieldmapper-package scoped function (not method) that would return the datatype of a class/field combination from the IDL, but didn't support object instances and required passing the full fieldmapper package name (or maybe JSON hint) to the function.

Revision history for this message
Thomas Berezansky (tsbere) wrote :

I will point out that my next large circ/holds project I plan on making new editors. I hope to do so with TPac-style interfaces instead of the current Dojo-based ones, and getting data types out would make it a require lot less hardcode-y configuration.

Changed in evergreen:
status: New → Triaged
Revision history for this message
Ben Shum (bshum) wrote :

Noting that we should make sure to add this to the next available milestone (like 2.5, so that we don't keep missing it?)

Ben Shum (bshum)
no longer affects: evergreen/master
Changed in evergreen:
milestone: none → 2.5.0-alpha
Dan Wells (dbw2)
Changed in evergreen:
milestone: 2.5.0-m1 → 2.5.0-m2
Dan Wells (dbw2)
Changed in evergreen:
assignee: nobody → Dan Wells (dbw2)
Revision history for this message
Dan Wells (dbw2) wrote :

Works as advertised. Pushed to master with an additional whitespace commit. Thanks, Mike!

Changed in evergreen:
status: Triaged → Fix Committed
assignee: Dan Wells (dbw2) → nobody
Ben Shum (bshum)
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.