cfpb / regulations-site

(DEPRECATED) Web interface for viewing U.S. federal regulations and other regulatory information
Other
28 stars 43 forks source link

Allow multiple dashes in section names #836

Closed chosak closed 6 years ago

chosak commented 6 years ago

This commit modifies the expected URL pattern for reg section labels so that instead of supporting only e.g. "1005-a" it also supports sections like "1005-a-interp". This fixes some 500 errors that were being generated due to a "1005-Appendices-Interp" section in Reg E.

You can confirm that this works to view diffs in the most recent Reg E content in regulations-stub by hitting this URL locally:

http://localhost:8000/eregulations/diff/1005-2/2016-24506/2016-24503_20181001?from_version=2016-24506#1005-2-a

The section label is passed around the code in various places so it's possible that adding this flexibility might break something else downstream. All current unit tests pass with this change (python manage.py test), however, so I'd rather enable this (which seems like a reasonable assumption, unless there's some section naming guidelines somewhere that are being violated) and handle errors as they come up.