Add is_tt2() like is_json() to database, constraint on atevdef.template

Bug #1066329 reported by Lebbeous Fogle-Weekley
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Confirmed
Wishlist
Unassigned

Bug Description

Today we give users few or no tools to test the TT2 markup they may enter when editing the template field of Action Trigger Event Definitions.

This could be a start to addressing that. It's just a database-level constraint around a function called is_tt2() that simply verifies that a given template compiles. It doesn't run the result, and it can't tell you whether your variables are defined or anything like that, and specific error messages don't bubble up to users using the staff client admin interfaces to edit templates or anything like that.

But it is at least a quick resource at the database level that will let you know when you haven't balanced all your IFs with ENDs, and that sort of thing.

Open to improvements, or merging as-is with proper testing/sign-off.

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/senator/schema-is-tt2

Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Of course what this really needs is a pgtap unit test!

Changed in evergreen:
status: New → Triaged
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.4.0-alpha1 → 2.4.0-beta
Revision history for this message
Ben Shum (bshum) wrote :

Tested this and the upgrade script will fail if the DB applied doesn't have Template installed. If we add this, we'll have to include another required dependency for that in the README for standalone DB servers.

Error like:

ERROR: Can't locate Template.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at line 5.
BEGIN failed--compilation aborted at line 5.
CONTEXT: compilation of PL/Perl function "is_tt2"

Changed in evergreen:
status: Triaged → Incomplete
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.4.0-beta → 2.4.0-rc
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.4.0-rc → 2.5.0-alpha
Ben Shum (bshum)
no longer affects: evergreen/2.5
Dan Wells (dbw2)
Changed in evergreen:
milestone: 2.5.0-m1 → 2.5.0-m2
Dan Wells (dbw2)
Changed in evergreen:
milestone: 2.5.0-m2 → 2.5.0-alpha1
Remington Steed (rjs7)
Changed in evergreen:
milestone: 2.5.0-alpha1 → 2.5.0-alpha2
Dan Wells (dbw2)
Changed in evergreen:
milestone: 2.5.0-alpha2 → 2.5.0-beta1
Revision history for this message
Bill Erickson (berick) wrote :

Two things:

1. It seems that any value I pass to is_tt2() always results in TRUE. I can't make the check fail.

2. I've pushed a commit to working/user/berick/lp1066329-schema-is-tt2 which contains the needed INSTALL notes and release notes Upgrade Notes addition.

Dan Wells (dbw2)
Changed in evergreen:
milestone: 2.5.0-beta1 → 2.5.0-rc
Dan Wells (dbw2)
Changed in evergreen:
milestone: 2.5.0-rc → 2.5.1
Ben Shum (bshum)
Changed in evergreen:
milestone: 2.5.1 → 2.5.2
Dan Wells (dbw2)
Changed in evergreen:
milestone: 2.5.2 → none
Revision history for this message
Kathy Lussier (klussier) wrote :

What is the status of this bug? Should it still be set to Incomplete?

Revision history for this message
Galen Charlton (gmc) wrote :

Grabbing this to tidy up (by adding a pgTap test case and so forth).

Changed in evergreen:
status: Incomplete → Confirmed
milestone: none → 2.next
assignee: nobody → Galen Charlton (gmc)
tags: removed: pullrequest
Elaine Hardy (ehardy)
tags: added: actiontrigger wishlist
tags: removed: wishlist
Galen Charlton (gmc)
Changed in evergreen:
assignee: Galen Charlton (gmc) → nobody
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.